Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Help with BLKPROC and BLOCKPROC (Matlab)

Status
Not open for further replies.

Romeo8627

Newbie level 3
Newbie level 3
Joined
Nov 12, 2010
Messages
3
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,301
Hi,

Here is the objective of what I am trying to do:
I have two images
Image 1: (3500x3000 pixels)
Image 2: (1250x1050 pixels)

I convert the pixel values into binary. Then, I replace the LSB of Image1 with data bits (each bit) from Image2.


Here is the problem:
After reshaping Image1 to row matrix, using dec2bin gives a OUT OF MEMORY error.
So I try to use BLKPROC and BLOCKPROC. They both work dor the dct2 but not for my function. Please help!!

NOTE: While trying to learn blkproc, I am using a very small matrix A with 12 elements.

(I am quite new to Matlab and programming in general. May take me a little more time than others to understand the concepts. Simple language will be very much appreciated.)

Here is my code:

%%%%%% Main Program %%%%%%


%Sample matrix (will be replaced by image data later)
A = uint8(1:12);

% fun = @bin2_img; % Didn't work!! Script is below
% fun= @dct2; % Works!!


fun = @(x) dec2bin(x); % Didn't work

% I want to process the matrix in blocks of 1x3
bin_i = blockproc(A,[1 3], fun);




%%%%%% bin2_img %%%%%%

function y = bin2_img(img_n)

y = dec2bin(img_n);



I have gone through the documentation of the commands. However, I still don't get the internal working of the blkproc and blockproc commands.
Is the whole image passed first and then broken into blocks or is it first broken down and sent passed to the required function?

Thank you very much! All help is appreciated. :)
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top