i need negative image

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 日
What have you done so far? Negating the image will depend on its data range, but when you have that it is a simple calculation.
Miss SHOOSH
Miss SHOOSH 2015 年 10 月 28 日
I haven't done anything so far :( if you can help plz give me instructions or the code if you can .. Thanks for answering
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 日

4 投票

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 日

3 投票

You can also use MATLAB's in built function- `imcomplement(Image)` for this purpose.
DGM
DGM 2022 年 4 月 25 日
編集済み: DGM 2022 年 4 月 25 日

1 投票

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)

質問済み:

2015 年 10 月 28 日

編集済み:

DGM
2022 年 4 月 25 日

Community Treasure Hunt

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

Start Hunting!

Translated by