How to crop image into 256 x 256 x 3 if the original image is 841 x 482 x 3 uint8 if using the centroide of the lesion with x_cent = 720 and y_cent = 151?
    6 ビュー (過去 30 日間)
  
       古いコメントを表示
    
    Dayangku Nur Faizah Pengiran Mohamad
 2023 年 6 月 13 日
  
    
    
    
    
    編集済み: Dayangku Nur Faizah Pengiran Mohamad
 2023 年 6 月 24 日
            Here my full codes to crop:
x_cent=720;
y_cent=151;
size_of_cropped_img=256;
centroide=[x_cent y_cent];
I=imread('1.jpg');
imshow(I)
xmin=x_cent-size_of_cropped_img/2;
ymin=y_cent-size_of_cropped_img/2;
I2=imcrop(I,[xmin ymin size_of_cropped_img size_of_cropped_img])
imshow(I2)
imwrite(I2,'1crop.jpg');
After I crop the image, the output is appeared and save not as 256 x 256 x 3 but 251 x 257 x 3 uint8.
How to crop with exact dimension I want if the original image is 841 x 482 x 3 uint8?
0 件のコメント
採用された回答
  Walter Roberson
      
      
 2023 年 6 月 13 日
        I2 = I(ymin:ymin+size_of_cropped_img-1, xmin:xmin+size_of_cropped_img-1, :);
3 件のコメント
  Dayangku Nur Faizah Pengiran Mohamad
 2023 年 6 月 24 日
				
      編集済み: Dayangku Nur Faizah Pengiran Mohamad
 2023 年 6 月 24 日
  
			その他の回答 (0 件)
参考
カテゴリ
				Help Center および File Exchange で Read, Write, and Modify Image についてさらに検索
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!


