Apply convolution to a specific area of image
up vote
0
down vote
favorite
I'm trying to apply convolution to a rectangle with specific from an image.
If I use filter2d
function it will apply convolution to entire image.
Also, I think a solution could be to crop the original image, apply filter2d
to cropped image and copy cropped image over original image, but I don't think is the best solution.
How can I achieve convolution just for a specific area of image?
c++ opencv image-processing
|
show 1 more comment
up vote
0
down vote
favorite
I'm trying to apply convolution to a rectangle with specific from an image.
If I use filter2d
function it will apply convolution to entire image.
Also, I think a solution could be to crop the original image, apply filter2d
to cropped image and copy cropped image over original image, but I don't think is the best solution.
How can I achieve convolution just for a specific area of image?
c++ opencv image-processing
4
does subimaging work? cv::Rect yourImageRegion = cv::Rect(...); filter2D(image(yourImageRegion), image(yourImageRegion), ...);
– Micka
yesterday
@Micka Yes, it works. But this is the most efficient way?
– GameZone RO
yesterday
Memory usage should be O1, isn't it?
– Victor Gubin
yesterday
subimaging is ecfficient. But in-place editing syntax ofzen isn't, because temporary memory will be allocated. So if you are working on multiple images of the same size (e.g videostream) it might be better to allocate and use different source and destination images (.clone) and then filter on their subimages.
– Micka
yesterday
if only that subimage is relevant, you can use image(yourImageRegion).copyTo(...) where the target can be an empty Mat or a subimage of same size as the input (but different position if wanted).
– Micka
yesterday
|
show 1 more comment
up vote
0
down vote
favorite
up vote
0
down vote
favorite
I'm trying to apply convolution to a rectangle with specific from an image.
If I use filter2d
function it will apply convolution to entire image.
Also, I think a solution could be to crop the original image, apply filter2d
to cropped image and copy cropped image over original image, but I don't think is the best solution.
How can I achieve convolution just for a specific area of image?
c++ opencv image-processing
I'm trying to apply convolution to a rectangle with specific from an image.
If I use filter2d
function it will apply convolution to entire image.
Also, I think a solution could be to crop the original image, apply filter2d
to cropped image and copy cropped image over original image, but I don't think is the best solution.
How can I achieve convolution just for a specific area of image?
c++ opencv image-processing
c++ opencv image-processing
edited 23 hours ago
asked yesterday
GameZone RO
1816
1816
4
does subimaging work? cv::Rect yourImageRegion = cv::Rect(...); filter2D(image(yourImageRegion), image(yourImageRegion), ...);
– Micka
yesterday
@Micka Yes, it works. But this is the most efficient way?
– GameZone RO
yesterday
Memory usage should be O1, isn't it?
– Victor Gubin
yesterday
subimaging is ecfficient. But in-place editing syntax ofzen isn't, because temporary memory will be allocated. So if you are working on multiple images of the same size (e.g videostream) it might be better to allocate and use different source and destination images (.clone) and then filter on their subimages.
– Micka
yesterday
if only that subimage is relevant, you can use image(yourImageRegion).copyTo(...) where the target can be an empty Mat or a subimage of same size as the input (but different position if wanted).
– Micka
yesterday
|
show 1 more comment
4
does subimaging work? cv::Rect yourImageRegion = cv::Rect(...); filter2D(image(yourImageRegion), image(yourImageRegion), ...);
– Micka
yesterday
@Micka Yes, it works. But this is the most efficient way?
– GameZone RO
yesterday
Memory usage should be O1, isn't it?
– Victor Gubin
yesterday
subimaging is ecfficient. But in-place editing syntax ofzen isn't, because temporary memory will be allocated. So if you are working on multiple images of the same size (e.g videostream) it might be better to allocate and use different source and destination images (.clone) and then filter on their subimages.
– Micka
yesterday
if only that subimage is relevant, you can use image(yourImageRegion).copyTo(...) where the target can be an empty Mat or a subimage of same size as the input (but different position if wanted).
– Micka
yesterday
4
4
does subimaging work? cv::Rect yourImageRegion = cv::Rect(...); filter2D(image(yourImageRegion), image(yourImageRegion), ...);
– Micka
yesterday
does subimaging work? cv::Rect yourImageRegion = cv::Rect(...); filter2D(image(yourImageRegion), image(yourImageRegion), ...);
– Micka
yesterday
@Micka Yes, it works. But this is the most efficient way?
– GameZone RO
yesterday
@Micka Yes, it works. But this is the most efficient way?
– GameZone RO
yesterday
Memory usage should be O1, isn't it?
– Victor Gubin
yesterday
Memory usage should be O1, isn't it?
– Victor Gubin
yesterday
subimaging is ecfficient. But in-place editing syntax ofzen isn't, because temporary memory will be allocated. So if you are working on multiple images of the same size (e.g videostream) it might be better to allocate and use different source and destination images (.clone) and then filter on their subimages.
– Micka
yesterday
subimaging is ecfficient. But in-place editing syntax ofzen isn't, because temporary memory will be allocated. So if you are working on multiple images of the same size (e.g videostream) it might be better to allocate and use different source and destination images (.clone) and then filter on their subimages.
– Micka
yesterday
if only that subimage is relevant, you can use image(yourImageRegion).copyTo(...) where the target can be an empty Mat or a subimage of same size as the input (but different position if wanted).
– Micka
yesterday
if only that subimage is relevant, you can use image(yourImageRegion).copyTo(...) where the target can be an empty Mat or a subimage of same size as the input (but different position if wanted).
– Micka
yesterday
|
show 1 more comment
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53372632%2fapply-convolution-to-a-specific-area-of-image%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
4
does subimaging work? cv::Rect yourImageRegion = cv::Rect(...); filter2D(image(yourImageRegion), image(yourImageRegion), ...);
– Micka
yesterday
@Micka Yes, it works. But this is the most efficient way?
– GameZone RO
yesterday
Memory usage should be O1, isn't it?
– Victor Gubin
yesterday
subimaging is ecfficient. But in-place editing syntax ofzen isn't, because temporary memory will be allocated. So if you are working on multiple images of the same size (e.g videostream) it might be better to allocate and use different source and destination images (.clone) and then filter on their subimages.
– Micka
yesterday
if only that subimage is relevant, you can use image(yourImageRegion).copyTo(...) where the target can be an empty Mat or a subimage of same size as the input (but different position if wanted).
– Micka
yesterday