Sprite Kit Make an inverse SKCropNode - crop

I need to make an inverse crop I need to make that instad to crop the fill mask crop the not fill area of the mask, I donĀ“t know if it is possible , any ideas?
Thanks

Related

FLUTTER: Blend imaged with Median Filter

i need to blend a lot of images taken with camera plugin (ui.Image format) using a median filter like in photoshop.
I currently usi canvas with drawImage and Paint.BlendMode (i'm using lighten which makes a kinda similar effect), but there is no "median" blend mode.
Median filter is done by taking a median value of every single channel RGB of all the images.
So... is there anything for median filter in dart/flutter, or i need to check manually all the image pixels? In this second case, how can i convert ui.Image in a class which allows me to get the single pixel and write it in another image?
Example:
color = image.getPixel(x, y);
newImage.setPixel(x, y, color);
Thank you in advance!
You can convert ui.image to RGB in flutter, but such manipulation will be prohibitively slow. You need some additional package, e.g. https://pub.dev/packages/photofilters or some other.

How to blend tone mapping noise into an image without a patch effect?

I would like to create tone mapping (including contrast change, brightness change, gamma change) noises in specific areas of a facial image (eyes, mouth, nose).
I've managed to auto extract the required features from the image.
I've used imadjust to create contrast change (for example) on the specific features of the image and then I've blended them using vision.AlphaBlender and a mask of the extracted areas.
The result is the patched image below:
What should I do in order to blend the noised feature into the original image with a natural effect which won't create a patchy image?
The answer to my question is taking the mask of the extracted areas.
apply Gaussian noise on the mask which will create a blurring effect on the mask.
Then, apply by weighting , the blurred mask on the original image to blend the noise into the image natuarlly and that way preventing any patch effect as displayed on the attached image in my question.
Here is the code snippet:
% create a guassian filter
G = fspecial('gaussian', [25 25], 20);
% blur the mask - make sure your original mask is a double type
blurredMask = imfilter(mask,G,'same');
% blend the image , the noised image and the original
% image by weighting with the blurred mask
image = originalImage.*(1-blurredMask ) + noisedImage.*blurredMask;
I hope I've helped someone with my question and my answer.

imageresizer: how can I get crop and rotate to work in an editor in the right order?

I am using http://imageresizing.net/ tools to create an editor.
The user can crop and rotate, but when they crop first and then rotate they lose the correct crop coords because the image coords have changed
for example, given a 100x100 image with a crop of the top left 50x50 pixels would then get rotated clockwise and now shows the crop as the original bottom left 50x50 pixels of the source image.
another example with images:
step one crop:
step two rotate:
coords haven't changed, but now it is no longer the proper crop area
does anyone know of a way to have the crop be relative to the original instead of the origin point?
Are you building something like StudioJS?
StudioJS uses ImageResizer.js to manage the command string and translate co-ordinates.
Consider a workflow where your user crops, rotates, and then re-crops the image. To preserve the original crop you will need to translate the coordinates in javascript. ImageResizer.js can do this.

MATLAB Image cropper for multiple images?

I have 19 images and I would like to be able to crop them all the same way, cropping off the same area on each image. But I need to look at the first image and determine what part of the image I want to crop. Then I would like to apply that crop to all the other images. My idea is that I could save the four corner points from the first crop and then iterate though the other 18 images using the 4 points to properly set up the cropping. Does this seem like a good approach? Or does anyone know of a Matlab program that does this already?, I search already.
Use IMCROP function from Image Processing Toolbox.
For the first image run it interactively and save the selected rectangle coordinates as a variable (rect):
[im_cropped rect] = imcrop(im);
Then for other images apply that coordinates:
im_cropped = imcrop(im, rect);

CvBOX2D Processing

I've already got my ROI(CvBOX2D type) by series of contour processing, now I just want to focus on the image part within the ROI, e.g.: feed this part into another processing function, how can I do that? I know there is CvSetImageROI, but the type is CvRect, so I should convert CvBox2D to CvRect first? Or some way to apply a mask on it with the area outside the box set to 0?
Thanks in advance!
Only axis aligned ROIs are directly supported in OpenCV (CvRect or IplROI). This is because they allow direct access to the image memory buffer.
There are 2 ways to go about working on a non-axis aligned ROI in OpenCV. Neither of them is as efficient as using axis-aligned ROIs.
Rotate your image, or bounding box, so that your ROI is now axis aligned in the resulting rotated image.
Note: the rotation will slightly blur your image.
Use a mask: Draw your ROI as a white rectangle on a black BG the same size as the image, and give your processing functions this mask as the additional parameter.
Note: not all functions support masks.
I would recommend option 1 if you really must stay within the exact bounds of your ROI. Otherwise, just use the bounding rect.
Use c++ api of opencv. seriously. do it.
cv::Rect roi = cv::RotatedRect(box).boundingRect();
Mat_<type> working_area(original_mat, roi);
// now operate on working_area
Note: this will operate on the bounding rect. I didn't find information on how to create a mask out of rotatedrect. Probably you have to do it by hand in a scanline fashion.

Resources