Ask Your Question
1

Changing value in the mat

asked 2015-04-17 08:12:56 -0500

zms gravatar image

Hello, I have a mat format Mat data = [ 0,0,0,0,255,0,0,255,0,0,0,255,0,0,0,255,0,0,0,0,255,0,0,255,255,255.........]

I would like to change the value of 255 to 1 for the Mat. Is there any instructions that I can use to change the value in a faster way?

edit retag flag offensive close merge delete

Comments

I guess here you will find the information you want. If speed is what you are looking for LookUpTable, i.e. LUT(), is the fastest way to access pixel values.

theodore gravatar imagetheodore ( 2015-04-17 08:27:44 -0500 )edit

1 answer

Sort by ยป oldest newest most voted
4

answered 2015-04-17 08:36:50 -0500

Just

data.setTo(1, data==255);
edit flag offensive delete link more

Comments

+1, Right solution than mine.

Haris gravatar imageHaris ( 2015-04-17 09:22:27 -0500 )edit

Question Tools

1 follower

Stats

Asked: 2015-04-17 08:12:56 -0500

Seen: 1,180 times

Last updated: Apr 17 '15