i have done segmentation of image using ''createMask'' function which is mentioned below. now how can i get back the original image that is by desegmentation. thank you in advanced . reply as earliest possible

조회 수: 1 (최근 30일)
function [BW,maskedRGBImage] = createMask(RGB)
% Convert RGB image to chosen color space
I = rgb2hsv(RGB);
% Define thresholds for channel 1 based on histogram settings
channel1Min = 0.685;
channel1Max = 0.922;
% Define thresholds for channel 2 based on histogram settings
channel2Min = 0.000;
channel2Max = 1.000;
% Define thresholds for channel 3 based on histogram settings
channel3Min = 0.000;
channel3Max = 0.924;
% Create mask based on chosen histogram thresholds
BW = (I(:,:,1) >= channel1Min ) & (I(:,:,1) <= channel1Max) & ...
(I(:,:,2) >= channel2Min ) & (I(:,:,2) <= channel2Max) & ...
(I(:,:,3) >= channel3Min ) & (I(:,:,3) <= channel3Max);
% Invert mask
BW = ~BW;
% Initialize output masked image based on input image.
maskedRGBImage = RGB;
% Set background pixels where BW is false to zero.
maskedRGBImage(repmat(~BW,[1 1 3])) = 0;

답변 (1개)

DGM
DGM 2023년 1월 11일
편집: DGM 2023년 1월 11일
If you can run the above code, then you necessarily already have the thing you want.
If the original image is lost and all you have is a binary mask and an arbitrarily small fraction of the original image pixels, it is not generally possible to accurately reconstruct the original image. The only information which can be generally known about the missing pixels is that they do not lie within the specified narrow sector in HSV. For uint8 inputs, that's only 78% of 16.8 million possibilities per pixel.

태그

Community Treasure Hunt

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

Start Hunting!

Translated by