이 질문을 팔로우합니다.
- 팔로우하는 게시물 피드에서 업데이트를 확인할 수 있습니다.
- 정보 수신 기본 설정에 따라 이메일을 받을 수 있습니다.
오류 발생
페이지가 변경되었기 때문에 동작을 완료할 수 없습니다. 업데이트된 상태를 보려면 페이지를 다시 불러오십시오.
이전 댓글 표시
0 개 추천
Hi. Currently i am doing a proj of image processing. i was told to create a funtion-m file with the function,arguements to display any image etc. but i do not know what are the input and output arguments i should put to display my image? I have tried studying/viewing from lots of videos to understand it but almost all explanation in arguments uses 'points'. I should plot my image first to do the function part? I am really confused, i hope any of you can give a simple explanation for me[ using codes etc ] to let me understand better. [ new to matlab ] thank you very much.
채택된 답변
Sabarinathan Vadivelu
2012년 9월 20일
There is an advantage in MATLAB that when a function is created, it can be used as a command in another file. say for example,
%Type this in one file
A=imread('input.jpg'); % Reads input Image
B = imagedisplay(A); % Call the function image display
% Here A, input argument, B output argument
figure, imshow(B);
-------------------------------------------------
%Type this in other file
function [output_img] = imagedisplay(input_img)
output_img = rgb2gray(input_img);
--------------------------------------------------
This function returns an image called ' output_img' and that is displayed in the main program.
댓글 수: 16
Adela
2012년 9월 20일
can you show me a format of writing statements for image display as example?
Adela
2012년 9월 20일
if i need to do more conversion instead of only gray scale, i will need more output arguement?
Yes. If your function returns how many variables will be the number of output arguments.
This probably reads the inputImage and displays an Image.
A = imread ('input.jpg');
figure, imshow(A);
Adela
2012년 9월 20일
can you carry on with the code you gave above with converion from garyscale to binary as example?
where do i call to display the image? & may i know what method of funtion is this? As matlab offers several different types of function. thank you:)
Adela
2012년 9월 20일
'Yes. If your function returns how many variables will be the number of output arguments.'
- what if i have to use the first output image to covert binary image?
For converting a gray image to binary image you can use this function.
BW = im2bw (I, level);
Here I gray scale image, BW represents the Binary image. As we know that binary image consists of pixel values 0 and 1 only. In a gray scale image pixel values varies from 0 to 255. So 'level' indicates the threshold value.
pixel values greater than level will be assigned with 1.
pixel values lesser than level will be assigned as 0.
Adela
2012년 9월 20일
yeap! i know that function. but how do i put it together witht the previous code?
Don't you think it would simply be
%Type this in other file
function [output_img] = imagedisplay(input_img)
output_img = rgb2gray(input_img);
output_img = im2bw(output_img);
Adela
2012년 9월 21일
thanks! but what do i do if i want to display grayscale and binary in main program at the same time?
Well, I'd have two axes and call imshow() to display each image in the desired axes. Does that make sense?
Adela
2012년 9월 21일
what do you mean by axes??
Oh boy, looks like you need to read the getting started section of the help or look at Doug Hull's tutorial blogs on MATLAB Central. An axes is one of the most basic controls, probably second only to a push button. It's a box on the GUI where you display your results, whether it's a line plot, a bar or pie chart, an image or whatever.
Adela
2012년 9월 21일
so i'll have to plot my image?
Are you playing with me? Don't you recall that you asked " where do i call to display the image"? Scroll up if you don't. So why do you ask " so i'll have to plot my image?"
And I never said "plot" your image, I said display it with imshow(). But I don't care one way or another what you do with your images - if you display them or not. That's your decision.
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Images에 대해 자세히 알아보기
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!웹사이트 선택
번역된 콘텐츠를 보고 지역별 이벤트와 혜택을 살펴보려면 웹사이트를 선택하십시오. 현재 계신 지역에 따라 다음 웹사이트를 권장합니다:
또한 다음 목록에서 웹사이트를 선택하실 수도 있습니다.
사이트 성능 최적화 방법
최고의 사이트 성능을 위해 중국 사이트(중국어 또는 영어)를 선택하십시오. 현재 계신 지역에서는 다른 국가의 MathWorks 사이트 방문이 최적화되지 않았습니다.
미주
- América Latina (Español)
- Canada (English)
- United States (English)
유럽
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
