How do i load a bitmap in Direct2D containing an alpha channel - visual-c++

I'm trying to load a bitmap in Direct2D that already contains an alpha channel, but Direct 2D seems to always ignore the alpha channel surrounding the desired image, replacing it with opaque black. Has anyone had success with this, and could show me their code? has anyone loaded a PNG file, and convert it to a bitmap? (MSDN says it's possible, but i can't find any cases where people have had success) or is this a mask thing?
In any case, could you show me a example code snippet explaining how to do one of these things? i'm trying to make a game, i have everything else working, and this is the literal final step. if someone could show me exactly how this is done, that would make my day! just transparency in an image. that's all i need.

Related

Phaser 3 load multiple single images from image file

I am new to phaser and I am having hard time to find this, probably cause I don't know how to call it. I know you can very simply load image through url, give it name and then use it in a sprite.
But what if I want to load image, which contains lots of different tiled images and use each of them separately? I'd like to somehow define, that for example rectangle at (x,y), using (width, height) is an image, that I can then use in spritesheet. I found tilemap definition files, but they are usually one file per image.
I found createStaticLayer, where you can pass 2-dimensional array of numbers, where number is order of tile and that works pretty much similarly to how I'd like to use it, but it is for background only and I still can't extract single "image" for single sprite.
How do I do that? How is that called? I am sure it exists, I am just missing it :)

removing shadow from colour image (3-channel (jpg) or 4-channel (png))

I am trying to isolate shadows from this image and remove them:
The reason why I am doing that is because shadow is problematic for my edge detection algorithm.
What should I do to remove the shadow? I haven't done this before, so I do not even know where to start from.
From the similar questions on SO I wasn't able to find anything to help me with my task.
I have the image in both: png and jpg format, so I am not even sure which format to use to start with.
That's a very interesting question. One option you can try is to divide the RGB values in the image by the grayscale intensity of the image. There is apparently another method explained here: https://onlinelibrary.wiley.com/doi/full/10.1002/col.21889.

Coloured textures for POIs

I was trying to use a coloured texture (PNG 24/RGB) for a POI (bicycle_parking) and it was not being rendered. It was added properly as a texture, it just won't be rendered on the POI.
After some testing I came to believe that POIs only accept grayscale textures that can later be filled up with a color. Is this right?
I also found out that the icon needs to be of a specific size (I got it working only at 32x32 pixels and 512x512, but the scaling did not make it look good). Is there any information regarding this?
Now I have a grayscale icon (mostly white) but the fill color does not change the white as expected. This is as far as I got..
Here's a set of icons similar to the ones I need to render into POIs
How could I achieve adding this type of icons as the texture of a POI? Workarounds/hacks are welcome as well :)
Thanks!
The texture of the Poi must have a size that is a power of 2 and goes from 32x32 up until 512x512. Also make sure that the colour code of that image is RGB anything else wont work. For the best visual result you have to create 3 sets of pngs for different screen densities, for example see heatmap_legend.png then look at heatmap_legend#2x.png and heatmap_legend#3x.png, you can find them in the "common" folder.
So turns out that the color wasn't a problem after all. It was quite tricky to get one image working, but once I had the image working, adding color to it and saving the PNG worked just fine.
The problem with the image size I experienced is still happening. You need to export it in 32x32, 64x64 or 96x96 in order to StyleEditor not to crash when opening the file.

Edit image, using openGL

I have been doing some searching the last couple of days and I have been curious how to do this. I have a UIImagePickerController.
So I want to add a effect like black and white, sepia, etc. I am creating a custom UIImagePickerVController and I am curious. Can this be done with OpenGL ES? If so, how?
This is possible through the use of pixel shaders using OpenGL-ES 2.0. You could also write an Objective-c++ routine that gets all the pixels of your image into an array then applies a custom algorithm to modify the color of the image.
Edit:
Here are some links that might help get you started.
http://www.sunsetlakesoftware.com/2010/10/22/gpu-accelerated-video-processing-mac-and-ios
http://www.dreamincode.net/forums/topic/76816-image-processing-tutorial/
http://www.efg2.com/Lab/Library/ImageProcessing/Algorithms.htm

Detect an object in image using IMAGEMAGICK

I have an image with Gray Background and 'CUP' in center of it... I want to detect the boundaries of the cup in this image.. After detecting CUP I want to extract the CUP from the image using IMAGEMAGICK.. Note I have many images with different objects (like CUP) in the center and with different background color .. So I am looking for a solution which is applicable to all of them..
Plz comment..
Maybe you could use edge-detection algorithms to isolate the shape of your main object: http://en.wikipedia.org/wiki/Edge_detection
You could also look into the code for the EdgeImage effect in ImageMagick, to see how they do it...

Resources