Logical XOR on SHP Layer using QGIS? - shapefile

I'd like to create a difference layer from two shapefiles using QGIS. I would have thought this is simple - maybe I'm doing something silly.
In the image below there are two layers - the orange one being of higher resolution than the green:
I'd like isolate the visible green area. I would have thought this is a Vector -> Geo Processing -> Difference operation but this doesn't seem to work.
So my question is - how do I create a layer of the visible green area?

It's possible that you just need to switch around the "Input" and "Difference" layer in the Difference tool.
Example with screenshots:
Select your polygon layer as the input and the countries layer as the difference layer
Result is everything from the polygon except countries:

Related

How can I emulate this color loop effect?

The title of this question isn't great at explaining what I want to do, so have this gif of the effect I want to emulate: https://i.imgur.com/zRqTSqf.gif (quality of the gif is shite, ik, please bear with me)
I think I need to use the LoopOut() expression for well, the loop, but I don't know how to animate the colors like that. Do I assign different colors in a shape? I'm fairly new to motion graphics, so I'm not familiar with technical terms and all that. Any help/guidance is appreciated!
I would recommend the following:
Create the square shape you are looking for, as a shape layer with a stroke and no fill
Duplicate the shape layer, for example, 4 times
Apply the Trim Paths effect to these layers and distribute it as you wish (for example, if using 4 layers first one from 0 to 25, second one from 25 to 50, third 50 to 75 and fourth one 75 to 100%.
Set a different color for each layer
Create a new Null Object and assign the Slider Control effect to it
Set the Trim Paths Offset property to be driven by the Slider property of the Slider Control (using the pick whip from each layer)
Animating the Slider property of the Slider control in the Null Object, driving the color of all the sides.
Use masks to fix the possible glitches on the vertices and to make it look nice
you can then alt-click on the stopwatch of the Slider property inside the Slider Control of the Null Object and type LoopOut(). Make sure that the first and last keyframes are correct so once the looping is activated the end is the same as the beginning and you should be good to go!
I think this should more or less point you in a possible way of solving it, let me know if you need more help!
In Illustrator, draw a square with a stroke, no fill, and rotate it 45 degrees. And on a separate layer, draw 6 triangles in the desired colours. Example below:
Save as an AI file. Import this artwork into After Effects, setting Import Kind to Composition.
Set the composition length to 4 seconds.
Set the track matte for the triangles layer to the Alpha Matte of the square layer. (#1 in the above)
Open the rotation property of triangles, set a key frame on frame 1, then go to 4 seconds, and set a key frame of 1 rotation. (#2 in the above)
Precompose these layers, then apply a CC Light Burst 2.5 effect for the glow.
Result is as below.

Image bounding boxes from sprite sheet

I've a sprite sheet containing a set of icons as shown here:
I'd like to get the bounding box (at pixel precision) of all icons inside it, some cases like list, grid have to be considered as only one icons. Any ideas are more than welcome.
I think the main issue in your problem is that some icons contain disjoint parts.
If all the icons were in only one part, you could just find the "connected components" (groups of white pixels) in your image and isolate them.
I don't know your level in image processing but to connect the parts of one icons, I would probably use dilation, which is a morphological method to expand (under constraints) the areas of maximum intensity in an image.
If you need any clarification, please let me know !
In general, it is not possible: only the humans have enough context to determine which of the disjoint parts belong together. You can approximate it using various ways, but it's a lost cause - and IMHO completely unnecessary. Imagine writing a test for this functionality - it's impossible, it requires a human in the loop, since the results for any particular icon sheet don't generalize. Knowing that the algorithm works for some sheet tells you nothing about whether it will work for some other sheet that you know nothing about a-priori.
It'd be simpler to manually colorize each sprite to have a color different than that of its neighbors. Then a greedy algorithm could find the bounding boxes easily without having to approximate anything.

How can you graph error as a shaded region?

When using TGraphErrors, the error bars appear as crosses, in the absence of significant X errors and many, many data points (such as MCA with 16k bins or so) I'd like to be able to remove the single points and single error bars and graph the error as a shaded region bounding the curve from above and below.
But I'm still a rank beginner at using ROOT, and I cannot figure out how to leverage TGraphErrors to do what I want. Will I need to instead use a TMultiGraph instead (and calculate the above and below bounding curves) and if so how can I control the shading region?
Something like the below would be along the lines of what I'm looking for. Source
Take a look at the TGraphPainter documentation which gives a few examples. One way is to draw the TGRaphErrors using option 4:
A smoothed filled area is drawn through the end points of the vertical error bars.
You will probably find that to get the final plot to look as you want, you have to draw the same graph multiple times - once to get the shaded region, then again on top to get the central curve.
This blog post gives a working example. It's written in PyROOT, but can be easily adapted to C++.

cocos2d-x ResolutionPolicy::SHOW_ALL show nice images instead of black gaps

When in cocos2d-x you set ResolutionPolicy::SHOW_ALL then it might appear black areas from top-bottom or from left-right sides. Can I cover the black area with some nice images?
I don't think you can just add something into those back areas.
Instead the solution is to build a scene which already contain the nice images you want to add. The steps are:
Use this inside your AppDelegate::applicationDidFinishLaunching() to detect screen size:
CCSize frameSize = pEGLView->getFrameSize();
Set a design resolution proportional to this frameSize maintaining its aspect ratio.
Put your "content" in the mid. Then, you have to calculate where are the "black areas" and add sprites to cover them. Keep in mind that for different screen the holes can be different, so you need to do some maths there and properly cover different hole sizes.
So, doing ResolutionPolicy::SHOW_ALL sets the openGL view to that size. That's why that can't be done with that.
On the other hand, there are many ways to tackle this.
What i did was :
1. Don't set the ResolutionPolicy.
Use a layer for those nice images/effects.
Create a new layer in that same scene and set the width and height of that layer according to aspect ratio of your content. And make this as your primary game view.

Finding all the regions in a webpage's image

I am working on a project where I need to find different regions present in an image(for any web page) like - navigation bar, menu bar, body, advertisement section etc. First I want to segment my entire image into distinct regions/sections using Image processing.
What I have done:
1st approach: I ran edge detection algorithm(Canny), this way I could see different regions in the form of rectangular boxes. However, I couldn't find a way to recognize all these regions.
2nd approach: I dealt with Hough transform to get all the horizontal and vertical lines which can help me in deciding different rectangular sections in the image. However, I am not able to come up with some concrete approach to use this houghlines to find all the rectangular regions imbibed in the image.
Any kind of your help is highly appreciated!