From: Slava Chesnokov on
Hello, please help me with my 2 question =) :
There is an image: http://files.me.com/icefenix/9rt7d6 (124x115)
I need to get this: http://files.me.com/icefenix/eboepl (256x256)

I.e. I need to put the first image of a black square (256x256). Or enlarge the first picture of a black color to the desired size.

Thx
From: Oleg Komarov on
"Slava Chesnokov" <icefennix(a)gmail.com> wrote in message <hl9fsi$pfo$1(a)fred.mathworks.com>...
> Hello, please help me with my 2 question =) :
> There is an image: http://files.me.com/icefenix/9rt7d6 (124x115)
> I need to get this: http://files.me.com/icefenix/eboepl (256x256)
>
> I.e. I need to put the first image of a black square (256x256). Or enlarge the first picture of a black color to the desired size.
>
> Thx
Wow, that stuff is moving...gross. I don't wanna mess with it if I was you.

Oleg
From: ImageAnalyst on
Slava Chesnokov:

Just like you'd expect: find the limits and crop it.
Here's some demo code:

filename = 'C:\Documents and Settings\Slava Chesnokov\My Documents
\Temporary stuff\A22.bmp';
rgbImage = imread(filename);
subplot(2, 2, 1);
imshow(rgbImage, []);
title('Original RGB Image', 'FontSize', 24);
set(gcf, 'Position', get(0,'Screensize')); % Maximize figure.
meanRGBImage = mean(rgbImage, 3);
subplot(2, 2, 2);
imshow(meanRGBImage, []);
title('Monochrome Image', 'FontSize', 24);
horizontalProfile = mean(meanRGBImage, 1);
verticalProfile = mean(meanRGBImage, 2);
x = find(horizontalProfile > 0);
x1 = x(1);
x2 = x(end);
y = find(verticalProfile > 0);
y1 = y(1);
y2 = y(end);
croppedImage = imcrop(rgbImage, [x1, y1, x2-x1+1, y2-y1+1]);
subplot(2, 2, 3);
imshow(croppedImage, []);
title('Cropped RGB Image', 'FontSize', 24);
From: Slava Chesnokov on
Hello again.
I think, you do not understand me correctly.
I have only the image "A2.bmp"
Image "A22.bmp" I created using Photoshop, but I need to create it using Matlab.

I hope for your help, thank you.
From: ImageAnalyst on
To add black padding around an image, use the padarray() function.