how to pass image data to a function

4 Ansichten (letzte 30 Tage)
solomon adenew
solomon adenew am 4 Aug. 2014
Beantwortet: Image Analyst am 4 Aug. 2014
the below function is a function that calculate the texture of objects in grayscale image from its binary mask. I have boring of errors when I pass an image data to this function code. please any one can help me! how can I pass the gray scale image:-
for example, I=imread('soap105.jpg'), how can I pass this image data to the function below
function handles = MeasureTexture( handles, varargin ),where handles is a function handler
  1 Kommentar
Harsha Medikonda
Harsha Medikonda am 4 Aug. 2014
If you need to pass the data read from an image to a function named “calculate”, you do it the following way
% I=imread(‘image’)
% calculate(I)
Where “image” is the image you want to read. With reference to your specific function,What are the input parameters that your function expects? What are the error messages that you are observe? For information on working with grey scale images, refer to the link below Analysing an Image For information on the using functions in MATLAB, refer to the link below Functions in MATLAB

Melden Sie sich an, um zu kommentieren.

Antworten (1)

Image Analyst
Image Analyst am 4 Aug. 2014
If MeasureTexture is a function inside your main GUI, then just get rid of varagin and replace it with some name for the image that you refer to it by in your function. For example in the callback for some pushbutton, have this:
I = imread('soap105.jpg');
handles = MeasureTexture(handles, I);
Then in the function definition for MeasureTexture:
function handles = MeasureTexture(handles, inputImage)
% Code in the function refers to "inputImage" whenever it needs to use the image variable.

Kategorien

Mehr zu Modify Image Colors finden Sie in Help Center und File Exchange

Produkte

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by