Ask Your Question
0

Parallel READ Access on Mats

asked 2019-08-08 15:37:30 -0600

Hello all,

i want to speedup an algorithm (complete local binary pattern with circle neighbours) for which i iterate trough all pixels and calculate some stuff with it neighbours (so i need neighbour pixel access).

Currently i do this by iterating over all pixels with one thread/process. I want to parallelize this task by dividing the input image into multiple ROIs and calculate each ROI seperatly (with multiple threads).

The Problem here is, that the ROIs are overlapping (because to calculate a pixel, sometimes i need to look at neighbours far away) and its possible that multiple threads accessing Pixel-Data (READING) at same time. Is that a Problem if two or more threads reading same Mat at same Indices at same time?

Is it also a problem, if i write to the same Mat parallel but at different indices?

edit retag flag offensive close merge delete

Comments

Der Luftmensch gravatar imageDer Luftmensch ( 2019-08-08 19:42:51 -0600 )edit

1 answer

Sort by ยป oldest newest most voted
1

answered 2019-08-08 18:07:49 -0600

Tetragramm gravatar image

Reading is no problem at all.

Writing to different locations is ok, as long as you don't do anything that alters the Mat header. No resizing, changing data-types, ect.

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2019-08-08 15:37:30 -0600

Seen: 189 times

Last updated: Aug 08 '19