Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8908845
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T03:17:12+00:00 2026-06-15T03:17:12+00:00

I am trying pass a .png image from the console in matlab to a

  • 0

I am trying pass a .png image from the console in matlab to a function called bwconversion. The function I have written does work when I assign the a variable name to the image file in the console screen – i.e.:

>>a = imread('1.png');
>>bwconversion(a);

However I need the code to work whereas I can pass it the file path directly such as:

>>bwconversion('J:\Vision\ColourIm\1.png');

But the above returns errors indicating the image was not passed to the function?

Please find my very basic function below:

function bwconversion(imIn)

%Convert Image to Black and White
gr = rgb2gray(imIn);
bw = im2bw(gr, 0.04);
clear gr;
imshow(bw);

I’ll be grateful for any advice that can be offered!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T03:17:13+00:00Added an answer on June 15, 2026 at 3:17 am

    Why not simply pass the file name as the parameter?

    function bwconversion(imIn_name)
    
    % Read the image
    imIn = imread(imIn_name);
    
    % Convert Image to Black and White
    gr = rgb2gray(imIn);
    bw = im2bw(gr, 0.04);
    clear gr;
    imshow(bw);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to implement a function in Django to upload an image from
I'm trying to pass a byte array from an image to an activity through
I have a function that creates Google maps markers. I pass in data from
Trying to pass a string argument to a function, which will then be used
im trying to pass two parameters to a function, i being an int value
I'm trying to convert a PDF to a PNG image (at least the cover
/*****UPDATED** ***/ r.com/YH3cm.png I am trying to figure out in the above image, how
I have a simple PHP service I'm trying to hit from an Android app,
I am trying to pass an argument to a JavaScript function getConfirmation() and my
I am trying to pass an image over python socket for smaller images it

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.