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;
}







5












$begingroup$


Given an image and a subimage (as a rectangle or pixel ranges):



img = ExampleData[{"TestImage", "Lena"}];
f = FindFaces[img]; HighlightImage[img, f]


enter image description here



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]


enter image description here



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.










share|improve this question











$endgroup$














  • $begingroup$
    For that matter, doesn't look like FindFaces returns index slices, only less useful rectangles.
    $endgroup$
    – M.R.
    2 days ago


















5












$begingroup$


Given an image and a subimage (as a rectangle or pixel ranges):



img = ExampleData[{"TestImage", "Lena"}];
f = FindFaces[img]; HighlightImage[img, f]


enter image description here



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]


enter image description here



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.










share|improve this question











$endgroup$














  • $begingroup$
    For that matter, doesn't look like FindFaces returns index slices, only less useful rectangles.
    $endgroup$
    – M.R.
    2 days ago














5












5








5


1



$begingroup$


Given an image and a subimage (as a rectangle or pixel ranges):



img = ExampleData[{"TestImage", "Lena"}];
f = FindFaces[img]; HighlightImage[img, f]


enter image description here



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]


enter image description here



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.










share|improve this question











$endgroup$




Given an image and a subimage (as a rectangle or pixel ranges):



img = ExampleData[{"TestImage", "Lena"}];
f = FindFaces[img]; HighlightImage[img, f]


enter image description here



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]


enter image description here



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






share|improve this question















share|improve this question













share|improve this question




share|improve this question








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 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
















$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










1 Answer
1






active

oldest

votes


















6













$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] &]


enter image description here



You can use ImageConvolve or whatever you need instead of Blur.



Fold is there to account for multiple rectangles.






share|improve this answer









$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














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
});


}
});














draft saved

draft discarded


















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









6













$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] &]


enter image description here



You can use ImageConvolve or whatever you need instead of Blur.



Fold is there to account for multiple rectangles.






share|improve this answer









$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
















6













$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] &]


enter image description here



You can use ImageConvolve or whatever you need instead of Blur.



Fold is there to account for multiple rectangles.






share|improve this answer









$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














6














6










6







$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] &]


enter image description here



You can use ImageConvolve or whatever you need instead of Blur.



Fold is there to account for multiple rectangles.






share|improve this answer









$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] &]


enter image description here



You can use ImageConvolve or whatever you need instead of Blur.



Fold is there to account for multiple rectangles.







share|improve this answer












share|improve this answer



share|improve this answer










answered 2 days ago









KubaKuba

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


















  • $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


















draft saved

draft discarded




















































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.




draft saved


draft discarded














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





















































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







Popular posts from this blog

Taj Mahal Inhaltsverzeichnis Aufbau | Geschichte | 350-Jahr-Feier | Heutige Bedeutung | Siehe auch |...

Baia Sprie Cuprins Etimologie | Istorie | Demografie | Politică și administrație | Arii naturale...

Nicolae Petrescu-Găină Cuprins Biografie | Opera | In memoriam | Varia | Controverse, incertitudini...