Pixelmath equation to put "0s" (black) in a region of an image


I went through your Fundamentals PixelMath module and have completed it. I'm weak at programming so not sure how to accomolish the following:
I currently use the Colormask script to create masks. I then Clonestamp with black to "clean" up the mask sometimes. I am able to isolate a certain components of the mask that way.

How can I choose a region H and W to make black using PM equation?

Comments

  • The easiest way to do this is to use the GAME script so that you can draw on the image directly. 
    Just draw the regions you want to be black... and then press the "write to Files/VIews button to select all of the files or views to do this to. That is pretty much it. 

    Alternatively you an generate a mask with the GAME script and apply it to your ColorMask... then using the pixel math expression "0" .. you can write zeros to your ColorMask image.

    Finally... to directly answer your question..if you want the plain vanilla PixelMath expression that writes a rectangle (or ellipse)... this is possible as well... but really it would be a "busy work" kind of exercise. In the case of a rectangle, you would specify four values... the x0,y0 (top left corner of the rectangle) and the W and H. My video on making crosshairs in PixelMath explains this.

    -the Blockhead

  • By the way...the writing black to Files/Views was my idea. :)
    It was designed to be used for Selective Rejection..but you can use it in the way I described.
    -the ego-validation-seeking Blockhead
  • Thanks Adam.  I only see a way to create ellipses.  How do I create a rectangle? This will work great if I can define a rectangle.
    Do I leave the default selection as gradient mask?
  • Ok, I see how to just draw/adjust points freeform.  This will work great I think.
  • Yes Gary... this is why I suggested this method unlike Fred. I think you would agree this method has greater flexibility.
    In your case, you want a binarized mask. But it automatically does this for writing zeros.
    if(function rt(){return!!window.Ember||(!!window.Vue||(!!window.Meteor||(!(!window.React&&!document.querySelector("[data-reactroot], [data-reactid]"))||!!(window.angular||document.querySelector(".ng-binding, [ng-app], [data-ng-app], [ng-controller], [data-ng-controller], [ng-repeat], [data-ng-repeat]")||document.querySelector('script[src*="angular.js"], script[src*="angular.min.js"]')))))}()){window.postMessage({singlePageAppCheck:true})}else{window.postMessage({singlePageAppCheck:false})}
    -the Blockhead
  • Thanks Adam! Game script is a great way to achieve what I’m looking for.
Sign In or Register to comment.