After creating an image, I want to read more information from it

1 回表示 (過去 30 日間)
bozheng
bozheng 2023 年 9 月 14 日
コメント済み: bozheng 2023 年 9 月 14 日
can you tell me where need to rewrite, thanks
----------------------------------------------------------------------------
image = imread('20230913q.jpg');
[height, width, ~] = size(image);
crop_width = floor(width / 2);
crop_height = floor(height / 2);
cropped_image = image(1:crop_height, crop_width+1:width, :);
imshow(cropped_image);
% 儲存圖片的路徑和檔名
save_path = fullfile('C:', 'Users', 'Administrator', 'Desktop', 'cropped_image.jpg');
% 儲存裁剪後的圖片
imwrite(cropped_image, save_path);
function avg = image_average(img)
% 計算一張圖片色階 0-12 的平均值
% 讀取圖片
img = imread('cropped_image.jpg');
% 轉換圖片色階
img = im2uint8(img); img = img / 12;
% 計算平均值
avg = mean(img(:));
end
  3 件のコメント
bozheng
bozheng 2023 年 9 月 14 日
bozheng
bozheng 2023 年 9 月 14 日
The color scale on the right will be set to 0-12.

サインインしてコメントする。

回答 (0 件)

カテゴリ

Help Center および File ExchangeMATLAB 快速入门 についてさらに検索

タグ

製品


リリース

R2020a

Community Treasure Hunt

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

Start Hunting!