How can i define part of image to work on (Specific pixel range) not whole image ?
1 visualizzazione (ultimi 30 giorni)
Mostra commenti meno recenti
How can i define part of image to work on (Specific pixel range) not whole image, because the image i worked in, is too big 10000*10000 pixel
How can i define just 1000*1000 pixel from the Image to be able to make quick processing ?
i need for example to define the Top-Right side
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1076275/image.jpeg)
Risposta accettata
DGM
il 25 Lug 2022
Modificato: DGM
il 3 Ott 2022
Depending on your needs, you may be able to use roifilt2(). Example
Given a 2D (grayscale) image and a logical mask, roifilt2() works by extracting a rectangular image around the mask region, processing it, and then compositing the result with the original image segment. The composited segment is inserted back into the original image.
There are limitations with roifilt2(). Since it only accepts 2D inputs, it can't process anything that requires color information. For tasks which don't require color information, color images can be processed in an external loop, but this often degrades the speed advantage. Also, roifilt2() can't utilize anything other than logical masks. While I doubt you need an antialiased or soft mask, it's something worth noting.
I have a yet-unpublished MIMT replacement for roifilt2() which addresses both of these shortcomings, but I'm not going to post it unless there's a need. (EDIT: it's up now. Webdocs here)
Alternatively, if you can define your ROI based on subscript ranges, you can just use basic array indexing to extract the rectangular ROI, process it, and insert it back into the image.
Since you haven't mentioned what the actual task is, consider the example wherein the task is to apply a blur to the ROI:
inpict = imread('cameraman.tif');
% extract roi from image (northeast corner)
sz = size(inpict);
yrange = 1:128;
xrange = sz(2)-128-1:sz(2);
roi = inpict(yrange,xrange,:);
% process roi
roi = imgaussfilt(roi,5);
% insert roi back into image
inpict(yrange,xrange,:) = roi;
imshow(inpict)
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Image Processing Toolbox in Help Center e File Exchange
Prodotti
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!