From: Kris zenitis on 17 Apr 2010 21:32 Hello there. I have a picture 500x500 and i want to mark the bounds of some rectangulars . Does anyone have any idea about how can i do such thing??
From: Walter Roberson on 18 Apr 2010 00:39 Kris zenitis wrote: > Hello there. I have a picture 500x500 and i want to mark the bounds of > some rectangulars . Does anyone have any idea about how can i do such > thing?? Mark on a plot: rectangle() Create a new picture with the rectangles: Suppose the x bounds are an N x 2 matrix named X, with the first column indicating the lower bound and the second column indicating the upper bound. Suppose likewise for Y. %do not overwrite the existing image newimage = oldimage; %make sure the bounds are in range and integral [rows, columns] = size(newimage); croppedX = min(max(1,floor(X)),rows); croppedY = min(max(1,floor(Y)),columns); for K = 1:size(X,1) %0 is black newimage(X(K,1) : X(K,2), [Y(K,1), Y(K,2)], :) = 0; %horz newimage([X(K,1), X(K,2)], Y(K,1) : Y(K,2), :) = 0; %vert end If you want to mark in white instead of black, figuring out what data value to write can be a bit complicated. If you want to mark in some other color completely, it gets more complicated yet, at least if you want to preserve the original image data class, and want to preserve indexed versus true-color versus grayscale .
From: Kris zenitis on 18 Apr 2010 12:44 Walter Roberson <roberson(a)hushmail.com> wrote in message <hqe2e2$6un$1(a)canopus.cc.umanitoba.ca>... > Kris zenitis wrote: > > Hello there. I have a picture 500x500 and i want to mark the bounds of > > some rectangulars . Does anyone have any idea about how can i do such > > thing?? > > Mark on a plot: rectangle() > > > Create a new picture with the rectangles: > > Suppose the x bounds are an N x 2 matrix named X, with the first column > indicating the lower bound and the second column indicating the upper > bound. Suppose likewise for Y. > > %do not overwrite the existing image > newimage = oldimage; > > %make sure the bounds are in range and integral > [rows, columns] = size(newimage); > croppedX = min(max(1,floor(X)),rows); > croppedY = min(max(1,floor(Y)),columns); > > for K = 1:size(X,1) > %0 is black > newimage(X(K,1) : X(K,2), [Y(K,1), Y(K,2)], :) = 0; %horz > newimage([X(K,1), X(K,2)], Y(K,1) : Y(K,2), :) = 0; %vert > end > > > If you want to mark in white instead of black, figuring out what data > value to write can be a bit complicated. If you want to mark in some > other color completely, it gets more complicated yet, at least if you > want to preserve the original image data class, and want to preserve > indexed versus true-color versus grayscale . I do not clearly understand what you mean with X,Y i ve got a picture as i said and with im2col i divided into blocks of 9x9 and i want to marked them in the initial picture.
From: Kris zenitis on 18 Apr 2010 13:34 basically how can i define X, Y is this script ,i have the initial pixels sth like (1,441).
From: Kris zenitis on 18 Apr 2010 13:39 basically how can i define X, Y is this script ,i have the initial pixels sth like (1,441).
|
Next
|
Last
Pages: 1 2 Prev: remove scientific notation from plot axes Next: Convert C array into mxArray Type |