how to pass image data to a function

조회 수: 2 (최근 30일)
solomon adenew
solomon adenew 2014년 8월 4일
답변: Image Analyst 2014년 8월 4일
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
Harsha Medikonda
Harsha Medikonda 2014년 8월 4일
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

댓글을 달려면 로그인하십시오.

답변 (1개)

Image Analyst
Image Analyst 2014년 8월 4일
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.

카테고리

Help CenterFile Exchange에서 Modify Image Colors에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by