i need negative image

조회 수: 198 (최근 30일)
Miss SHOOSH
Miss SHOOSH 2015년 10월 28일
편집: DGM 2022년 4월 25일
Hello .. I need help with transformation in grey level to transform cameraman.tiff image to negative version .. using Matlab code .. thanks
  댓글 수: 4
Adam
Adam 2015년 10월 28일
Off the top of my head
doc imread
doc max
are all you really need beyond simple operations, although I'm not familiar with whether any specific scaling or shifting of the image data is done when negating it.
Miss SHOOSH
Miss SHOOSH 2015년 10월 28일
Ok Thanks .. anyone else can help? I have to apply negative transformation to the image cameraman.tif

댓글을 달려면 로그인하십시오.

답변 (3개)

Image Analyst
Image Analyst 2015년 10월 28일
Try this with a uint8 image:
positiveImage = imread('CameraMan.tif');
negativeImage = 255 - positiveImage;

VIBHOR AGARWAL
VIBHOR AGARWAL 2018년 2월 8일
편집: VIBHOR AGARWAL 2018년 2월 8일
You can also use MATLAB's in built function- `imcomplement(Image)` for this purpose.

DGM
DGM 2022년 4월 25일
편집: DGM 2022년 4월 25일
It's best to avoid writing your code around unchecked assumptions of array class.
If you have Image Processing Toolbox, imcomplement() should work fine.
A = imread('peppers.png');
B = imcomplement(A);
imshow(B)
If you don't have IPT, MIMT iminv() (attached) does the same thing. It will work fine for images of any standard numeric/logical class. If you want to know how it works, just open it up and see.
A = imread('peppers.png');
B = iminv(A);
imshow(B)

카테고리

Help CenterFile Exchange에서 Image Processing Toolbox에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by