Is there a SubImageApply?Is there a way to convert an image into a Graph?Is there a fast method of generating...
What is the hex versus octal timeline?
Why in most German places is the church the tallest building?
Prove your innocence
Compelling story with the world as a villain
Why isn't "I've" a proper response?
Are modern clipless shoes and pedals that much better than toe clips and straps?
Why does The Ancient One think differently about Doctor Strange in Endgame than the film Doctor Strange?
how do you harvest carrots in creative mode
Was there ever a treaty between 2 entities with significantly different translations to the detriment of one party?
Cultural before-and-afters
Why did MS-DOS applications built using Turbo Pascal fail to start with a division by zero error on faster systems?
Is there any way to keep a player from killing an NPC?
Which household object drew this pattern?
for loop not working in bash
Can pay be witheld for hours cleaning up after closing time?
What is wrong about this application of Kirchhoffs Current Law?
How to respectfully refuse to assist co-workers with IT issues?
What to say to a student who has failed?
I got kicked out from graduate school in the past. How do I include this on my CV?
Can you feel passing through the sound barrier in an F-16?
How do I request a longer than normal leave of absence period for my wedding?
Non-visual Computers - thoughts?
Why is my Earth simulation slower than the reality?
Are there any music source codes for sound chips?
Is there a SubImageApply?
Is there a way to convert an image into a Graph?Is there a fast method of generating a Standard Deviation image from a frame stack?Is there a Mathematica barcode reader?Mask outliers in an imageGetting image data values with coordinates in circular regionIs there a bug of InverseDistanceTransform?Is there something wrong with MedianFilter?Using ImageTransformation to implement relativistic aberration effect
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ margin-bottom:0;
}
$begingroup$
Given an image and a subimage (as a rectangle or pixel ranges):
img = ExampleData[{"TestImage", "Lena"}];
f = FindFaces[img]; HighlightImage[img, f]
How would one apply operations just that sub-image, leaving the rest of the pixels unchanged?
(* would maybe be something like this *)
ImageConvolve[img, BoxMatrix[1]/11, "MapAt" -> f]
ImageApply[Max, img, "Subimage" -> f]
Is there a built-in or slick way to this (without resorting to ImageData
and MapAt
)? I thought there was something like this added in 12, but was perhaps mistaken. If not, ImageMapAt
or ImageApplyAt
or some such thing would surely make a nice repository function.
image-processing image
$endgroup$
add a comment |
$begingroup$
Given an image and a subimage (as a rectangle or pixel ranges):
img = ExampleData[{"TestImage", "Lena"}];
f = FindFaces[img]; HighlightImage[img, f]
How would one apply operations just that sub-image, leaving the rest of the pixels unchanged?
(* would maybe be something like this *)
ImageConvolve[img, BoxMatrix[1]/11, "MapAt" -> f]
ImageApply[Max, img, "Subimage" -> f]
Is there a built-in or slick way to this (without resorting to ImageData
and MapAt
)? I thought there was something like this added in 12, but was perhaps mistaken. If not, ImageMapAt
or ImageApplyAt
or some such thing would surely make a nice repository function.
image-processing image
$endgroup$
$begingroup$
For that matter, doesn't look likeFindFaces
returns index slices, only less useful rectangles.
$endgroup$
– M.R.
2 days ago
add a comment |
$begingroup$
Given an image and a subimage (as a rectangle or pixel ranges):
img = ExampleData[{"TestImage", "Lena"}];
f = FindFaces[img]; HighlightImage[img, f]
How would one apply operations just that sub-image, leaving the rest of the pixels unchanged?
(* would maybe be something like this *)
ImageConvolve[img, BoxMatrix[1]/11, "MapAt" -> f]
ImageApply[Max, img, "Subimage" -> f]
Is there a built-in or slick way to this (without resorting to ImageData
and MapAt
)? I thought there was something like this added in 12, but was perhaps mistaken. If not, ImageMapAt
or ImageApplyAt
or some such thing would surely make a nice repository function.
image-processing image
$endgroup$
Given an image and a subimage (as a rectangle or pixel ranges):
img = ExampleData[{"TestImage", "Lena"}];
f = FindFaces[img]; HighlightImage[img, f]
How would one apply operations just that sub-image, leaving the rest of the pixels unchanged?
(* would maybe be something like this *)
ImageConvolve[img, BoxMatrix[1]/11, "MapAt" -> f]
ImageApply[Max, img, "Subimage" -> f]
Is there a built-in or slick way to this (without resorting to ImageData
and MapAt
)? I thought there was something like this added in 12, but was perhaps mistaken. If not, ImageMapAt
or ImageApplyAt
or some such thing would surely make a nice repository function.
image-processing image
image-processing image
edited 2 days ago
M.R.
asked 2 days ago
M.R.M.R.
15.4k6 gold badges61 silver badges204 bronze badges
15.4k6 gold badges61 silver badges204 bronze badges
$begingroup$
For that matter, doesn't look likeFindFaces
returns index slices, only less useful rectangles.
$endgroup$
– M.R.
2 days ago
add a comment |
$begingroup$
For that matter, doesn't look likeFindFaces
returns index slices, only less useful rectangles.
$endgroup$
– M.R.
2 days ago
$begingroup$
For that matter, doesn't look like
FindFaces
returns index slices, only less useful rectangles.$endgroup$
– M.R.
2 days ago
$begingroup$
For that matter, doesn't look like
FindFaces
returns index slices, only less useful rectangles.$endgroup$
– M.R.
2 days ago
add a comment |
1 Answer
1
active
oldest
votes
$begingroup$
Assuming f
matches {__Rectangle}
:
subImageApply[image_Image, sub : {__Rectangle}, filter_] := Fold[
ImageCompose[#, #2[[1]], #2[[2]], {0, 0}] &
, image
, { filter @ ImageTrim[image, #], #[[1]] } & /@ sub
]
subImageApply[img, f, Blur[#, 12] &]
You can use ImageConvolve or whatever you need instead of Blur
.
Fold
is there to account for multiple rectangles.
$endgroup$
$begingroup$
Elegant! Thanks :) I think if they just added "Masking" option to every image operation that would be super
$endgroup$
– M.R.
2 days ago
$begingroup$
@M.R. You are welcome. I expected it to be easier but that is fine enough I guess. Otoh image-processing is not my area so maybe I missed something.
$endgroup$
– Kuba♦
2 days ago
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "387"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
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%2fmathematica.stackexchange.com%2fquestions%2f203996%2fis-there-a-subimageapply%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
$begingroup$
Assuming f
matches {__Rectangle}
:
subImageApply[image_Image, sub : {__Rectangle}, filter_] := Fold[
ImageCompose[#, #2[[1]], #2[[2]], {0, 0}] &
, image
, { filter @ ImageTrim[image, #], #[[1]] } & /@ sub
]
subImageApply[img, f, Blur[#, 12] &]
You can use ImageConvolve or whatever you need instead of Blur
.
Fold
is there to account for multiple rectangles.
$endgroup$
$begingroup$
Elegant! Thanks :) I think if they just added "Masking" option to every image operation that would be super
$endgroup$
– M.R.
2 days ago
$begingroup$
@M.R. You are welcome. I expected it to be easier but that is fine enough I guess. Otoh image-processing is not my area so maybe I missed something.
$endgroup$
– Kuba♦
2 days ago
add a comment |
$begingroup$
Assuming f
matches {__Rectangle}
:
subImageApply[image_Image, sub : {__Rectangle}, filter_] := Fold[
ImageCompose[#, #2[[1]], #2[[2]], {0, 0}] &
, image
, { filter @ ImageTrim[image, #], #[[1]] } & /@ sub
]
subImageApply[img, f, Blur[#, 12] &]
You can use ImageConvolve or whatever you need instead of Blur
.
Fold
is there to account for multiple rectangles.
$endgroup$
$begingroup$
Elegant! Thanks :) I think if they just added "Masking" option to every image operation that would be super
$endgroup$
– M.R.
2 days ago
$begingroup$
@M.R. You are welcome. I expected it to be easier but that is fine enough I guess. Otoh image-processing is not my area so maybe I missed something.
$endgroup$
– Kuba♦
2 days ago
add a comment |
$begingroup$
Assuming f
matches {__Rectangle}
:
subImageApply[image_Image, sub : {__Rectangle}, filter_] := Fold[
ImageCompose[#, #2[[1]], #2[[2]], {0, 0}] &
, image
, { filter @ ImageTrim[image, #], #[[1]] } & /@ sub
]
subImageApply[img, f, Blur[#, 12] &]
You can use ImageConvolve or whatever you need instead of Blur
.
Fold
is there to account for multiple rectangles.
$endgroup$
Assuming f
matches {__Rectangle}
:
subImageApply[image_Image, sub : {__Rectangle}, filter_] := Fold[
ImageCompose[#, #2[[1]], #2[[2]], {0, 0}] &
, image
, { filter @ ImageTrim[image, #], #[[1]] } & /@ sub
]
subImageApply[img, f, Blur[#, 12] &]
You can use ImageConvolve or whatever you need instead of Blur
.
Fold
is there to account for multiple rectangles.
answered 2 days ago
Kuba♦Kuba
111k12 gold badges220 silver badges567 bronze badges
111k12 gold badges220 silver badges567 bronze badges
$begingroup$
Elegant! Thanks :) I think if they just added "Masking" option to every image operation that would be super
$endgroup$
– M.R.
2 days ago
$begingroup$
@M.R. You are welcome. I expected it to be easier but that is fine enough I guess. Otoh image-processing is not my area so maybe I missed something.
$endgroup$
– Kuba♦
2 days ago
add a comment |
$begingroup$
Elegant! Thanks :) I think if they just added "Masking" option to every image operation that would be super
$endgroup$
– M.R.
2 days ago
$begingroup$
@M.R. You are welcome. I expected it to be easier but that is fine enough I guess. Otoh image-processing is not my area so maybe I missed something.
$endgroup$
– Kuba♦
2 days ago
$begingroup$
Elegant! Thanks :) I think if they just added "Masking" option to every image operation that would be super
$endgroup$
– M.R.
2 days ago
$begingroup$
Elegant! Thanks :) I think if they just added "Masking" option to every image operation that would be super
$endgroup$
– M.R.
2 days ago
$begingroup$
@M.R. You are welcome. I expected it to be easier but that is fine enough I guess. Otoh image-processing is not my area so maybe I missed something.
$endgroup$
– Kuba♦
2 days ago
$begingroup$
@M.R. You are welcome. I expected it to be easier but that is fine enough I guess. Otoh image-processing is not my area so maybe I missed something.
$endgroup$
– Kuba♦
2 days ago
add a comment |
Thanks for contributing an answer to Mathematica Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
Use MathJax to format equations. MathJax reference.
To learn more, see our tips on writing great answers.
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%2fmathematica.stackexchange.com%2fquestions%2f203996%2fis-there-a-subimageapply%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
$begingroup$
For that matter, doesn't look like
FindFaces
returns index slices, only less useful rectangles.$endgroup$
– M.R.
2 days ago