RobertLT
RobertLT

Reputation: 41

How to make remap of particular area in OpenCV

I am facing the performance drop issue. I made some research and it seems that remap function takes too much time. Image size is VGA, but interesting area has about about 1/4 of this area. Therefore, I want to use remap() only for this region and finally get image with about 1/4 of VGA area.

This is image input in VGA resolution -green rect is trackableArea Rect

Desired output but in VGA

Generated by:

remap(originalCornersSamples[i], rview, map1, map2, INTER_NEAREST);

When I try to make remap only on specific area:

remap(frame_bgr, rview, map1(trackableArea), map2(trackableArea), INTER_NEAREST);

I got as expected - stretched desired image with desired resolution of the trackableArea rect.

map1 and map2 were generated from getPerspectiveTransform to get only TV screen from the input image. The trackableArea is a Rect like here (green lines):

Any ideas how to make it possible or how the remap() should look like?

Upvotes: 1

Views: 1193

Answers (1)

RobertLT
RobertLT

Reputation: 41

I answer to myself :) So this helped:

resize(map1,modified,Size(trackableArea.width,trackableArea.height), 0, 0,  INTER_CUBIC );

remap(frame_bgr, rview, modified, map2(trackableArea), INTER_NEAREST);

Upvotes: 1

Related Questions