이 질문을 팔로우합니다.
- 팔로우하는 게시물 피드에서 업데이트를 확인할 수 있습니다.
- 정보 수신 기본 설정에 따라 이메일을 받을 수 있습니다.
오류 발생
페이지가 변경되었기 때문에 동작을 완료할 수 없습니다. 업데이트된 상태를 보려면 페이지를 다시 불러오십시오.
이전 댓글 표시
0 개 추천
Hi, I have some pictures, some of them are 2D and some are 3D. I need to convert 2D to 3D if I choose to open 2D picture( because I use histeq and imhist) I don´t know how to do write a command for converting to 3D if it is needed and not if is choosen 3D picture.
Thanks a lot
jane
p.s: sorry for my english
댓글 수: 1
Image Analyst
2013년 4월 4일
histeq() (a pretty much useless function by the way) and imhist() require 2D (grayscale) images, not 3D (color) images, so why do you want to convert to 3D/color if you say you're going to use histeq() and imhist()???
채택된 답변
Walter Roberson
2013년 4월 4일
0 개 추천
if ndim(TheArray) == 2
TheArray = TheArray(:,:,[1 1 1]);
end
댓글 수: 13
I´m not sure it is correct now, but it doesn´t work so I do something wrong. I have
[file path]=uigetfile({'*.jpg';'*.bmp';'*.jpeg';'*.png'}, 'Načti
obrázek');
image=[path file];
handles.file=image;
if ndim(image) == 2
image = image(:,:,[1 1 1]);
end
handles.imga=im2double(rgb2gray(imread(image)));
and error is : Undefined function 'ndim' for input arguments of type 'char'.
Error in analyza2>pushbuttonload_Callback (line 167) if ndim(image) == 2
I should have suggested ndims() instead of ndim().
However... why are you needing to convert the 2D images to 3D? You would then just use rgb2gray() to convert back down to 2D.
Do not name a variable "image": doing that interferes with using the important image() function.
You should use fullfile() instead of concatenating the path and file.
filename = fullfile(path, file);
handles.file = filename;
imga = imread(filename);
if ndmins(imga) == 3
imga = rgb2gray(imga);
end
imga = im2double(imga);
handles.imga = imga;
janepear
2013년 4월 4일
Thanks a lot...it works great!. Please may I have a one more question? Why I should not use: [file path]=uigetfile({'*.jpg';'*.bmp';'*.jpeg';'*.png'}, 'Načti obrázek'); image=[path file]; ?
Walter Roberson
2013년 4월 4일
The "path" returned by uigetfile() might not include a directory delimiter at the end of it.
Image Analyst
2013년 4월 4일
Now can you answer our question about why you want 3D when imhist and histeq cannot accept 3D images?
janepear
2013년 4월 4일
Ok :-) when I have a all pictures in 3D, I can use rgb2gray and it works for histeq and imhist, but I use colormaps too and they don´t work on 2D (I think). So Ï thought that it will be easier to have all in 3D in one variable and if i need to use histeq or imhist I will transform it.
Sure im beginner and It might by wrong way...
Walter Roberson
2013년 4월 4일
colormaps only work on 2D.
janepear
2013년 4월 4일
Ok so this is weird because it always wrote error
Error using rgb2gray>parse_inputs (line 81) MAP must be a m x 3 array.
Walter Roberson
2013년 4월 4일
If you have a colormapped image that you want to convert to grayscale, use http://www.mathworks.com/help/images/ref/ind2gray.html
Image Analyst
2013년 4월 4일
편집: Image Analyst
2013년 4월 4일
You are confused, or I am. If you have grayscale (2D) images, you do not need to make them color (3D) and then use rgb2gray() or some other way to convert them back to grayscale (2D), which is how they started. You're just doing a round trip grayscale->color->grayscale for no reason. You've given us no compelling need why you would need to do that. There's no reason why you can use imhist() and (the useless) histeq() directly on your original grayscale images.
Tell me, in a larger sense or context, what you want to do, and we'll show you how to do it. For example you want to read in all the images in a folder, no matter whether color or grayscale, display their histograms, increase their contrast, and write out the contrast-increased images to a new folder, or something like that. Please give me the big picture (no pun intended) of what this project is supposed to accomplish.
Ok,I´m sure that I´m the confused here :-). So i want to load picture ( 2 or 3D array) and then you can do negativ,contrast,brightness, gamma , equalization or choose in popmenu colormap.
Image Analyst
2013년 4월 4일
This is not the larger picture. What does this code do? Why are you trying to somehow do something with a bone colormap? What do you want as a final image, handles.cm? A color image, an indexed image, or a grayscale image? It looks like a grayscale image so you only need to do that if ndims(handles.imga) == 3. But even if you do it only for color images, I'm not sure why a bone colormap is involved when you end up as grayscale.
1.)I want to show what you can do with utrasound picture...I use colormaps to show that sometimes is better to use copper or summer or another coloration of image
추가 답변 (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)
