Android Studio Blur Specific Area of Image Given Coordinates of the Area to be Blurred Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 17/18, 2019 at 00:00UTC (8:00pm US/Eastern) The Ask Question Wizard is Live! Data science time! April 2019 and salary with experience Should we burninate the [wrap] tag?Resize a large bitmap file to scaled output file on AndroidHow to get the width and height of an android.widget.ImageView?How to split image to 2 parts?Android Studio: Add jar as library?How to scale a bitmap larger than 4096 pixels?Blur image in specified area of an imageview androidAndroid Java taking screenshot of a view by ignoring area using coordinatesHow to find area of difference between 2 bitmaps using Renderscript?The x y parameters definitionHow to Blur a specific portion in an Image given a RectF object in Android using Canvas?

How do I mention the quality of my school without bragging

Letter Boxed validator

Do I really need recursive chmod to restrict access to a folder?

How does cp -a work

Is high blood pressure ever a symptom attributable solely to dehydration?

Withdrew £2800, but only £2000 shows as withdrawn on online banking; what are my obligations?

What causes the vertical darker bands in my photo?

Bonus calculation: Am I making a mountain out of a molehill?

Is there a service that would inform me whenever a new direct route is scheduled from a given airport?

G-Code for resetting to 100% speed

What is this single-engine low-wing propeller plane?

What are 'alternative tunings' of a guitar and why would you use them? Doesn't it make it more difficult to play?

How do I stop a creek from eroding my steep embankment?

What are the motives behind Cersei's orders given to Bronn?

What's the purpose of writing one's academic bio in 3rd person?

Doubts about chords

Stars Make Stars

What LEGO pieces have "real-world" functionality?

How can I make names more distinctive without making them longer?

How can I fade player when goes inside or outside of the area?

Why is "Consequences inflicted." not a sentence?

What makes black pepper strong or mild?

Is the address of a local variable a constexpr?

"Seemed to had" is it correct?



Android Studio Blur Specific Area of Image Given Coordinates of the Area to be Blurred



Announcing the arrival of Valued Associate #679: Cesar Manara
Planned maintenance scheduled April 17/18, 2019 at 00:00UTC (8:00pm US/Eastern)
The Ask Question Wizard is Live!
Data science time! April 2019 and salary with experience
Should we burninate the [wrap] tag?Resize a large bitmap file to scaled output file on AndroidHow to get the width and height of an android.widget.ImageView?How to split image to 2 parts?Android Studio: Add jar as library?How to scale a bitmap larger than 4096 pixels?Blur image in specified area of an imageview androidAndroid Java taking screenshot of a view by ignoring area using coordinatesHow to find area of difference between 2 bitmaps using Renderscript?The x y parameters definitionHow to Blur a specific portion in an Image given a RectF object in Android using Canvas?



.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;








0















I am trying to blur a specific part of an image according to some given coordinates. These coordinates make up a rectangle on the image, I want to blur this specific area on the image. I understand that RenderScript is the best way of achieving this but I have not been able to blur a specific area, only the whole image.



This is the code I have right now which blurs the entire image.



 int widthBlur = Math.round(image.getWidth() * BITMAP_SCALE);
int heightBlur = Math.round(image.getHeight() * BITMAP_SCALE);

Bitmap inputBitmap = Bitmap.createScaledBitmap(image, widthBlur, heightBlur, false);
Bitmap outputBitmap = Bitmap.createBitmap(inputBitmap);

RenderScript rs = RenderScript.create(this);
ScriptIntrinsicBlur theIntrinsic = ScriptIntrinsicBlur.create(rs, Element.U8_4(rs));
Allocation tmpIn = Allocation.createFromBitmap(rs, inputBitmap);
Allocation tmpOut = Allocation.createFromBitmap(rs, outputBitmap);
theIntrinsic.setRadius(BLUR_RADIUS);
theIntrinsic.setInput(tmpIn);
theIntrinsic.forEach(tmpOut);
tmpOut.copyTo(outputBitmap);

return outputBitmap;


At the moment I am not using x1, x2, y1 and y2 but these are the coordinates I have on the image which gives the rectangle on the image I want to blur. (x2-x1 gives width of rectangle and y2-y1 gives height of rectangle).










share|improve this question






























    0















    I am trying to blur a specific part of an image according to some given coordinates. These coordinates make up a rectangle on the image, I want to blur this specific area on the image. I understand that RenderScript is the best way of achieving this but I have not been able to blur a specific area, only the whole image.



    This is the code I have right now which blurs the entire image.



     int widthBlur = Math.round(image.getWidth() * BITMAP_SCALE);
    int heightBlur = Math.round(image.getHeight() * BITMAP_SCALE);

    Bitmap inputBitmap = Bitmap.createScaledBitmap(image, widthBlur, heightBlur, false);
    Bitmap outputBitmap = Bitmap.createBitmap(inputBitmap);

    RenderScript rs = RenderScript.create(this);
    ScriptIntrinsicBlur theIntrinsic = ScriptIntrinsicBlur.create(rs, Element.U8_4(rs));
    Allocation tmpIn = Allocation.createFromBitmap(rs, inputBitmap);
    Allocation tmpOut = Allocation.createFromBitmap(rs, outputBitmap);
    theIntrinsic.setRadius(BLUR_RADIUS);
    theIntrinsic.setInput(tmpIn);
    theIntrinsic.forEach(tmpOut);
    tmpOut.copyTo(outputBitmap);

    return outputBitmap;


    At the moment I am not using x1, x2, y1 and y2 but these are the coordinates I have on the image which gives the rectangle on the image I want to blur. (x2-x1 gives width of rectangle and y2-y1 gives height of rectangle).










    share|improve this question


























      0












      0








      0








      I am trying to blur a specific part of an image according to some given coordinates. These coordinates make up a rectangle on the image, I want to blur this specific area on the image. I understand that RenderScript is the best way of achieving this but I have not been able to blur a specific area, only the whole image.



      This is the code I have right now which blurs the entire image.



       int widthBlur = Math.round(image.getWidth() * BITMAP_SCALE);
      int heightBlur = Math.round(image.getHeight() * BITMAP_SCALE);

      Bitmap inputBitmap = Bitmap.createScaledBitmap(image, widthBlur, heightBlur, false);
      Bitmap outputBitmap = Bitmap.createBitmap(inputBitmap);

      RenderScript rs = RenderScript.create(this);
      ScriptIntrinsicBlur theIntrinsic = ScriptIntrinsicBlur.create(rs, Element.U8_4(rs));
      Allocation tmpIn = Allocation.createFromBitmap(rs, inputBitmap);
      Allocation tmpOut = Allocation.createFromBitmap(rs, outputBitmap);
      theIntrinsic.setRadius(BLUR_RADIUS);
      theIntrinsic.setInput(tmpIn);
      theIntrinsic.forEach(tmpOut);
      tmpOut.copyTo(outputBitmap);

      return outputBitmap;


      At the moment I am not using x1, x2, y1 and y2 but these are the coordinates I have on the image which gives the rectangle on the image I want to blur. (x2-x1 gives width of rectangle and y2-y1 gives height of rectangle).










      share|improve this question
















      I am trying to blur a specific part of an image according to some given coordinates. These coordinates make up a rectangle on the image, I want to blur this specific area on the image. I understand that RenderScript is the best way of achieving this but I have not been able to blur a specific area, only the whole image.



      This is the code I have right now which blurs the entire image.



       int widthBlur = Math.round(image.getWidth() * BITMAP_SCALE);
      int heightBlur = Math.round(image.getHeight() * BITMAP_SCALE);

      Bitmap inputBitmap = Bitmap.createScaledBitmap(image, widthBlur, heightBlur, false);
      Bitmap outputBitmap = Bitmap.createBitmap(inputBitmap);

      RenderScript rs = RenderScript.create(this);
      ScriptIntrinsicBlur theIntrinsic = ScriptIntrinsicBlur.create(rs, Element.U8_4(rs));
      Allocation tmpIn = Allocation.createFromBitmap(rs, inputBitmap);
      Allocation tmpOut = Allocation.createFromBitmap(rs, outputBitmap);
      theIntrinsic.setRadius(BLUR_RADIUS);
      theIntrinsic.setInput(tmpIn);
      theIntrinsic.forEach(tmpOut);
      tmpOut.copyTo(outputBitmap);

      return outputBitmap;


      At the moment I am not using x1, x2, y1 and y2 but these are the coordinates I have on the image which gives the rectangle on the image I want to blur. (x2-x1 gives width of rectangle and y2-y1 gives height of rectangle).







      android renderscript android-renderscript android-blur-effect






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Mar 8 at 16:15









      Zoe

      13.6k85486




      13.6k85486










      asked Mar 8 at 16:06









      Jaymin ShahJaymin Shah

      11




      11






















          0






          active

          oldest

          votes












          Your Answer






          StackExchange.ifUsing("editor", function ()
          StackExchange.using("externalEditor", function ()
          StackExchange.using("snippets", function ()
          StackExchange.snippets.init();
          );
          );
          , "code-snippets");

          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "1"
          ;
          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: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          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%2fstackoverflow.com%2fquestions%2f55066887%2fandroid-studio-blur-specific-area-of-image-given-coordinates-of-the-area-to-be-b%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown

























          0






          active

          oldest

          votes








          0






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes















          draft saved

          draft discarded
















































          Thanks for contributing an answer to Stack Overflow!


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

          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%2fstackoverflow.com%2fquestions%2f55066887%2fandroid-studio-blur-specific-area-of-image-given-coordinates-of-the-area-to-be-b%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

          1928 у кіно

          Захаров Федір Захарович

          Ель Греко