Filter löschen
Filter löschen

HOW TO PERFORM 3 LSB AND 4 LSB REPLACEMENT

1 Ansicht (letzte 30 Tage)
aditya sahu
aditya sahu am 11 Feb. 2017
Kommentiert: Geoff Hayes am 12 Feb. 2017
SUPPOSE I HAVE AN ARRAY OF 512*512 PIXEL ELEMENTS. I ALSO HAVE ANOTHER ARRAY 'DATA' OF O AND 1 VALUES. I HAVE TO REPLACE THE LAST 3 OR 4 LSB BITS OF EACH PIXEL WITH THE VALUES OF DATA ARRAY VALUES BASED ON SOME CONDITION. LET THE CONDITION IS
IF X==0
THEN I WILL APPLY 3 LSB REPLACEMENT
ELSE IF X==1
4 LSB REPLACEMENT
KINDLY SUGGEST ME ...HOW CAN I PROCEED...THANK YOU

Antworten (2)

Geoff Hayes
Geoff Hayes am 11 Feb. 2017
aditya - to replace the least significant bits of your pixel, you can use bitset. For example, suppose that X is zero, and we want to replace the last three bits with 101. We would do
X = uint8(0);
X = bitset(X,1,1);
X = bitset(X,2,0);
X = bitset(X,3,1);
and X is now five which what we expect with 00000101.
  2 Kommentare
aditya sahu
aditya sahu am 12 Feb. 2017
Bearbeitet: aditya sahu am 12 Feb. 2017
Thanks Geoff Hayes...actually , when x==0 we have to perform 3 LSB and for rest 4 LSB. when i apply your code then all pixels of original array becomes changing but i need some specific pixels which satisfy the conditions only
Geoff Hayes
Geoff Hayes am 12 Feb. 2017
aditya - please note the above is just an example of how to set specific bits and is meant only to indicate how you might do this. It is up to you to incorporate it into your main program...

Melden Sie sich an, um zu kommentieren.


Image Analyst
Image Analyst am 12 Feb. 2017
See my attached demos for how to set and view bitplanes.

Kategorien

Mehr zu Image Processing Toolbox finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by