フィルターのクリア

quantize ROI of an image in 3 spaces [0,10),(10,36],(36,255]

1 回表示 (過去 30 日間)
Anthony Sipitanos
Anthony Sipitanos 2017 年 10 月 20 日
回答済み: Sufiyan 2023 年 3 月 2 日
So i have a greyscale image named (c.png) and a ROI of that image (roi_c.png) The excersise asks me to quantize the ROI of the image in 3 spaces [0,10),(10,36],(36,255] and do some stuff atfer that . my question is how exaclty do I do that? do i use the imquantize function? there is this quant_A = imquantize(A,levels) but as far as i understand levels is the variable that shows in how many levels it will be quantized and if i use 3 it will not be in the spaces that I want. thanks in advance

回答 (1 件)

Sufiyan
Sufiyan 2023 年 3 月 2 日
Hello,
You can use imquantize function, where you must specify the levels as [10,36] so that it quantizes in to three levels ([0-10], [10-36], [36-255]). You can refer to the code below.
% Load the image
img = imread('img.jpg');
% Define the Region of interest(ROI) of image
roi = img(100:200, 150:450);
% Define the quantization ranges
ranges = [10 36];
% Quantize the ROI
quantized_roi = imquantize(roi, ranges);
% Display the original and quantized ROIs
figure;
subplot(1,2,1);
imshow(roi);
title('Original ROI');
subplot(1,2,2);
imshow(quantized_roi, []);
title('Quantized ROI');
you can go through imquantize to get more information about quantization levels.

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by