필터 지우기
필터 지우기

when i run the below code i get an error picture1 does not exist..where should i save the image to get the results

조회 수: 1 (최근 30일)
% Compute the integral image and use it to compute the sum of pixels over a rectangular region of an intensity image.
I = imread('Picture1.jpg');
figure; imshow(I);
intImage = integralImage(I);
% Define rectangular region as [startingRow, startingColumn, endingRow, endingColumn].
[sR, sC, eR, eC] = deal(3, 2, 3, 3);
% Compute the sum over the region using the integral image.
J = integralImage(I);
regionSum = J(eR+1,eC+1) - J(eR+1,sC) - J(sR,eC+1) + J(sR,sC);
% Calculate the mean
mean = regionSum/4;

채택된 답변

Hanif
Hanif 2013년 5월 21일
The file must be save in the matlab folder in order for you to call it just like that. If it is saved in My Documents in the My Pictures folder, you must call the directory of the image.
ie.
I = imread('C:\Documents and Settings\user1\My Documents\My Pictures');
  댓글 수: 3
divya
divya 2013년 5월 21일
thnks a lot ..i AM ABLE TO RESOLVE ERROR...BUT AFTER THAT ERROR IS RESOLVED I ENCOUNTERED OTHER ERROR WHEN I RUN...
Error using integralImage Expected I to be two-dimensional.
Error in integralImage (line 41) validateattributes(I, {'numeric','logical'}, {'2d', 'nonsparse', 'real'},...
Error in Untitled2 (line 10) intImage = integralImage(I);
Hanif
Hanif 2013년 5월 21일
Not too sure what that error means, that error might be an error from other parts of the code and is not related to Imread(...) or imshow(...). Many times a code will have multiple errors by only the first of many will display, try debugging and steping through to help find error. Sorry again, best of luck

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

추가 답변 (1개)

C.J. Harris
C.J. Harris 2013년 5월 21일
From the MATLAB help relating to imread:
If the file is not in the current directory or in a directory in the MATLAB path, specify the full pathname of the location on your system.
That is, the image must be in the folder from which you are calling the script, or on your MATLAB path.

카테고리

Help CenterFile Exchange에서 3-D Volumetric Image Processing에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by