why following error is appearing when i use other image
조회 수: 1(최근 30일)
표시 이전 댓글
Error using vertcat Dimensions of matrices being concatenated are not consistent.
댓글 수: 15
Geoff Hayes
2018년 4월 3일
Komal - please copy and paste the full error message that should include which line of code is throwing the error. And is the other image the one that you have attached? Remember, we can't easily run your GUI since you have not included the figure file nor have you outlined the steps that you have followed which generates the error.
Komal Gaikwad
2018년 4월 4일
편집: Walter Roberson
2018년 4월 5일
sir i am attaching the fig file:
Steps are as follows
1.run the code, after GUI is opened select image (i have used attached cameraman.jpg image, but if lena.jpg image is used no error is coming) after that add noise in the given box , next is click on noisy image. After the noisy image is displayed when i click on filtered image it is showing me the error as follows-->
"Error using vertcat
Dimensions of matrices being concatenated are not consistent.
Error in maingui1>fltimg_Callback (line 155)
p_im_n= [ zeros(ln,im_sz(2)) ; im_n; zeros(ln,im_sz(2))]; %%%%%%%%error showing here%%%%%
Error in gui_mainfcn (line 95)
feval(varargin{:});
Error in maingui1 (line 42)
gui_mainfcn(gui_State, varargin{:});
Error in matlab.graphics.internal.figfile.FigFile/read>@(hObject,eventdata)maingui1('fltimg_Callback',hObject,eventdata,guidata(hObject))
Error while evaluating UIControl Callback"
Geoff Hayes
2018년 4월 4일
The error message from the line
p_im_n= [ zeros(ln,im_sz(2)) ; im_n ; zeros(ln,im_sz(2))];
is telling you that the dimensions of the matrices that you are trying to concatenate are invalid. Since the error is for a vertical concatenation, this suggests that the columns of one or more of your matrices are invalid. I would put a breakpoint at this line and re-run your code. Look at the dimensions (rows and columns) for
zeros(ln,im_sz(2))
im_n
zeros(ln,im_sz(2))
Do all three have the same number of columns?
Komal Gaikwad
2018년 4월 5일
sir,but on lena.jpg no error is coming everything is working fine.Can't we make other images same as lena.jpg.? I tried by changing the size of image but still error is coming.
Geoff Hayes
2018년 4월 5일
So in your screen shot, look closely at the dimensions for im_n - is 225x225x3. And then with this code
p_im_n= [ zeros(ln,im_sz(2)) ; im_n ; zeros(ln,im_sz(2))];
you are trying to concatenate a 10x225 with a 225x225x3 matrix. Hence the error. I suspect that the Lena.jpg is a 2D image whereas the cameraman is 3D.
To fix this, just do
im_n = im_n(:,:,1);
if it is safe to assume that this image is grayscale (or use the appropriate MATLAB function to convert to grayscale).
Walter Roberson
2018년 4월 5일
Note: the original cameraman.tif image is 2D -- grayscale.
.jpg images are almost always RGB -- I have only ever seen one true grayscale JPEG that was not artificially created just to demonstrate that it is possible.
The three .jpg images you attached are all RGB images that happen to use only tones of grey.
Komal Gaikwad
2018년 4월 6일
ok ,sir thanx.One more doubt i have,i have to find variance of an image.I had read the theory of variance still not clear What if variance of first image is greater than the second image?
Walter Roberson
2018년 4월 6일
"What if variance of first image is greater than the second image"
What about it? That just means it has a higher typical range of values. If the second image is one being computed from the first, it could mean that the second image has been somehow smoothed relative to the first. You appear to be doing some kind of filtering for the purpose of denoising; noise is typically high frequency, so filtered images would tend to have less average change and so would tend to have lower variance.
Komal Gaikwad
2018년 4월 7일
ok sir,that mean my median filter is giving me the variance of 0.419 and my Wiener filter is giving 0.415.this mean wiener has better variance than median,correct?
Walter Roberson
2018년 4월 7일
I cannot say that it is "better".
Suppose you take a noisy image, and replace it all by the mean of the image. Then the variation between values would be 0 because they are all identical, so the variance would be 0. All of the information would have been filtered out of it. Is that "better" ?
I have a favorite example of Cosmic Microwave Background Radiation (CMBR): people used to think that it was noise in the astronomy images and worked hard to try to "fix" their systems to be lower noise. But eventually someone realized that there was a real cause for CMBR and that there was a bunch of information in it, and now there is a lot of active study of CMBR -- studies in which they take care to block out known stars as "noise" for this purpose.
"noise" can have information too, and you do not always know where the signal ends and the "real" noise begins.
Walter Roberson
2018년 4월 8일
Theoretically you can say nothing without more information.
If all you want is to lower the variance then divide the signal by 2 relative to its mean. Lower variance does not mean better signal: it can mean signal of smaller amplitude or it can mean signal that has had information removed. It is even possible to lower variance while increasing noise.
Suppose you were to take a sine wave of a number of cycles, no noise beyond problems with quantization of signals to finite representation. Now randomize the order of the samples. Clearly the result would be noise, and yet it would have the exact same variance. Variance alone cannot tell you how noisy a signal is.
답변(0개)
참고 항목
범주
Find more on Image Filtering and Enhancement in Help Center and File Exchange
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)
아시아 태평양
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)