clc;close all;clear all;a = imread('F:\TEST PICTURES\car.jpg');a = rgb2gray(a);[m n] = size(a);% to extract 7th bit plane
for i = 1:m for j = 1:n b7(i,j) = bitand(a(i,j),128); endendb7o = histeq(b7);%to extract 6th bit plane
for i = 1:m for j = 1:n b6(i,j) = bitand(a(i,j),64); endendb6o = histeq(b6);%to extract 5th bit plane
for i = 1:m for j = 1:n b5(i,j) = bitand(a(i,j),32); endendb5o = histeq(b5);%to extract 4th bit plane
for i = 1:m for j = 1:n b4(i,j) = bitand(a(i,j),16); endendb4o = histeq(b4);%to extract 3rd bit plane
for i = 1:m for j = 1:n b3(i,j) = bitand(a(i,j),8); endendb3o = histeq(b3);%to extract 2nd bit plane
for i = 1:m for j = 1:n b2(i,j) = bitand(a(i,j),4); endendb2o = histeq(b2);%to extract 1st bit plane
for i = 1:m for i = 1:n b1(i,j) = bitand(a(i,j),2); endendb1o = histeq(b1);%to extract 0th bit plane
for i = 1:m for j = 1:n b0(i,j) = bitand(a(i,j),1); endendb0o = histeq(b0);cc = 2*(2*(2*(2*(2*(2*(2*b7o+b6o)+b5o)+b4o)+b3o)+b2o)+b1o)+b0o;figure, imshow(cc)
MATLAB: Hi all… i am writing a program to histogram equalize particular bit planes in an image..but i am getting an error in the 1st bit plane..Attempted to access a(241,320); index out of bounds because size(a)=[240,320]. Error in BITPLANE (line 59)
bit planeindex out of bounds
Best Answer