From: Enigma Enlist on
I = imread('circuit.tif');
I2 = imcrop(I,[75 68 130 112]);
imview(I), imview(I2)

instead of mentioning these integers i want to mention ratios ... like i want to crop 0.1*rows ... nw when i m mentioning number of rows, it is cropping, but when i m using rows .. its giving this error

At compilation "rows" was determined to be variable. As a variable,
it is uninitialized, but function "rows" is now in context.
In MATLAB 7, you cannot use the same name in a single function as
both a function and a variable.
From: ImageAnalyst on
Maybe add this line:
[rows columns numberOfColorChannels] = size(I);
From: Enigma Enlist on
ImageAnalyst <imageanalyst(a)mailinator.com> wrote in message <8bad55cc-ec1f-4e5c-9dc2-41aa4c28af2f(a)b7g2000yqk.googlegroups.com>...
> Maybe add this line:
> [rows columns numberOfColorChannels] = size(I);

its working =) ... but i dint get y u used numberOfColorChannels
From: ImageAnalyst on
Enigma Enlist
Your posts read a lot faster if you use standard English (particularly
for the numerous non-native English speakers here) and not the
enigmatic lingo, like dint, m, nw, y, and u.

I used numberOfColorChannels because you can get into trouble if you
don't. For example if you ever want to scan the image over the number
of columns. Try this:

% Read in standard MATLAB color demo image.
rgbImage = imread('peppers.png');
[rows1 columns1] = size(rgbImage)
[rows2 columns2 numberOfColorBands] = size(rgbImage)

What you'll find is that columns1 and columns2 are different!!!!

rows1 =
384
columns1 =
1536
rows2 =
384
columns2 =
512
numberOfColorBands =
3

columns1 is actually the number of color channels times the actual
number of columns! Columns2 is the correct number - and that's why I
did it that way.

So that's the first reason. Secondly, a lot of people have gray scale
images that they think will be 2D images when they're read back in
from disk. But often these are stored on disk as a 3D true color
image, that just happens to have the red, green, and blue channels
identical. This happens VERY often and unless you check for that,
you'll get burned in a lot of ways when you try to do math on the
array ("number of dimensions doesn't match......" etc.), not to
mention that the number of columns could be wrong.
Good luck,
ImageAnalyst
 | 
Pages: 1
Prev: AutoCad Matlab
Next: matlab&simulink