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 Center および File ExchangeModify Image Colors についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by