A way to keep colors in black&white picture when changing image mode from index color to greyscale? - photoshop

I took pics like these
The files generated form the camera are bmp.
Problem is i need to load them in a certain program where i noticed works only when in photoshop i go to modes -> greyscale. The images are originally indexed color or RGB Color (which i used to make some adjustments - but end results is like u see in these pictures). But when i change mode to greyscale I notice the pics changing (though not sure because i mainly use the mean value from histogram to measure various areas with the square marquee tool -the mean value changes at around 10 points, but again unsure if i should be using that one or if there is some other way to measure the average value of a color in an area). But the image should remain same since its black&white right?

Related

Measuring sizes of before/after images in Photoshop

Perhaps my mind isn't mathematically competent enough to do this, but here it goes:
I am using Photoshop. I have 2 images taken from different heights. Both images have the same object in it (so the size of this object remains the same) but I am trying to resize both images so that this object is the same pixel size. That way I can properly measure the difference between other objects in the images with the proper ratio.
My end goal is to measure the differences of scars healing (before and after) using a same-size object in both images as a baseline.
To measure the difference in the photo, I have been counting pixels using the histogram feature:
Even though i changed the pixel width and height to roughly the same size, the 2 images have a drastically different number of pixels. So comparing the red or white from the before to the after won't make sense until I can get these to match.
Can anyone point me in the right direction here? How can I compare apples to apples here?
So went a different route here in case anyone was trying wondering what I did.
Rather than change the size of the images, just calculated the increase manually separately.

Drawing "boxes" on my PDF output

I am working on a corporate-level summary report for my employer. Because this is a fairly high-level report, I'm trying to "pretty" it up a bit (I think the standard SAS output is exceptionally ugly). I've managed to include graphics using ODS REGION and the like, but I'm having trouble generating a fairly basic bar chart.
All I want to do is draw boxes onto the PDF file by specifiying X,Y and W,H and the background color. I've gotten close using this SUGI paper (which employs ODS REGION with a PROC GSLIDE).
That works OK, but I've run into many vexing little issues. For example:
There's a minimum height and width for GSLIDE (appx 3 points) which has made it very difficult to represent small numbers on my bar graph
The corners of GSLIDE are slightly rounded, causing strange looking "artifacts" when attempting to overlay and stack them
There's apparently a "maximum" width (appx 480 points). I think I might be able to solve this with the GOPTIONS VSIZE attribute, but I have to be careful because if the ODS REGION and GSLIDE are exactly the same size, then SAS (for some reason) thinks that the GSLIDE is bigger than the REGION and fails to render GSLIDE properly.
I've searched the internet for an easier approach, but it seems there are few SAS programmers trying to do what I'm doing. I know that I'm reinventing the wheel a bit in that SAS providers bar charts via SAS/GRAPH, but they don't provide the level of customization I need to display the results the way I want them.
How can I draw a simple rectangular shape, with nice square corners, and no weird width/height limitations, on a PDF file?
This isn't direclty relevant to the question, but since it's been brought up, here's an idea of what the bar chart looks like:
Each row measures a metric across a mutually exclusive sub-section of a larger population. The Gray bar represents the total size of the population being measured. The blue bar measures the metric (and the reported number is the metric across the sub-section). The "white bar" is the size of the total population. (The light blue bar is an alternate metric displayed only for those who are curious - it will always be smaller than the blue bar.) Some sub-sections contain no data, so they are displayed as "N/A".
There's also a rolling total. So, after one or a few sub-sections are reported, they are rolled into the rolling total. The gray background groups the related sub-sections, with the rolling total reported at the bottom.
This is pretty much exactly what I want this chart to look like. If it can be done using standard SAS charts, I'd be happy to use them - but I think it's been easier to get this effect on my own by painting the graph myself.
I found a partial answer... you can use a LayoutRegion defined via PROC TEMPLATE to set the background color of an ODS REGION. You still must "put something" within the region to force SAS to render it (for example, ODS TEXT = " ";), but it removes at least one pain point: minimum and maximum sizes.
Unfortunately, the corners are still rounded, but I'll update this answer if I can figure out a way to fix that via an attribute or something.

how to detect an image with iPhone camera?

I am trying to detect an image of a chocolate wrapper with iPhone/iPad Camera.
I already got the image frames from video using avcapture.
But i can't figure out how to detect a specific part of the image?
Note:- the specific part i am mentioning is a pink ribbon which will always be the same.
can i match the image? if yes how? or should i get bitmap pixel data and match the unique color codes (but they can vary depending on light conditions and angle at which image is taken)?
Try the following two APIs:
http://www.iqengines.com;
http://intopii.com
This Solution is for the scenario where you are trying to detect specific part of the image with a specific colour (This part will be called Reference image). so we are going to match the colour codes of our reference image with the one taken from the camera in real time.
Step 1.
Create a media layer which will scan the particular part of the image taken from camera. This will narrow down the search area for colour codes and make the process faster, as there are thousands of colour codes in the image.
Step 2.
Get the colour codes from the image we just scanned.Create an array of the colour codes.
Step 3.
Now repeat the step 2 for 3 or 4 different light conditions.Because some colour codes change under different types of lights. Match the colour codes array to get the common colour codes.(These will be referred now on as Reference colour codes) These colour codes will be there for most of the cases.
Step 4.
Convert the image taken from camera in a pixel buffer.(Basically a collection of pixels). Now convert the pixel buffer into colour codes and compare them with reference colour codes.If all of them or more than 50% are matched. you have potential match.
Note:- i Followed this process and it works like magic. it sounds more complicated than it is and it is enough robust to help you get it working in few hours. In my case the wrapper i was scanning was squeezed and tested under different lights(sun,white CFL lamp, a yellow light from the bulb, and taken from different angles and distances). Still most of the reference colour codes were always there.
Gud luck!

Is there a way to take an image file and make its background transparent via VB .NET?

We have a system where people are being taken a face shot via a DSLR camera. We need the people's images with transparent background. What we're currently doing is taking the image and editing and cropping it in Photoshop, removing the background image with the Magic Eraser tool.
What I am looking for is a way to parse the image and automatically erase the semi-white background we have, along with the resizing and cropping. Is there some kind of library or code sample that does this without requiring manual intervention?
This is a real complex problem. Like the answer below suggested you'll need to do a fuzzy match on each pixel and set it to be transparent but you also need to detected other nearby pixels to make sure they are not close in color. A white tag on the shirt, white eyelids, hair, pale skin reflecting the flash. All are candidates to be removed by any greedy fuzzy logic.
Think about the Magic Wand tool in Photoshop. How good is it at detecting the edges of the person in the picture? Yeah, and that's the top standard of image editing software with thousands of engineering hours behind it.
This is not a feasible request for a Q&A format, and this is one of those things that humans just do better than machine. BUT, that doesn't mean it's not possible, and who knows, you might be the one to do it. Just don't do it in VB.NET please :)
Some pseudo-code to get an idea of what you need to do:
Bitmap faceShot = Bitmap.FromFile(filepath)
foreach pixel in faceShot
//the following line is where the magic happens, you can do any fuzzy match on the color that suits you
//figure out your color range and do a fuzzy match percentage wise
if (pixel between RGB(255,255,255) and RGB(250,235,215)) //white and antique white
pixel.setAlpha=0
endif
end foreach
You could start with this as a starting point for processing a single image,
http://www.java2s.com/Code/VB/2D/ProcessanImageinvertPixel.htm
Basically, if you have a constant background color (like the TV green-screen), it's just a matter of selecting pixels close to the color you are erasing and setting their Alpha level to 0 (transparent). Treating the RGB values like XYZ coordinates, you can do a 3d distance from your background color, and make everything within a certain threshold transparent.
As an improvement, you could also make everything within another threshold semi-transparent so the edges right around hair and stuff like that look softer and less harsh.
Alternatively, you could probably do the same exact thing with good results in Photoshop, as it should support batch processing.
Edit, thinking about it some more, you may want to use a green screen type background as well instead of an off-white one like you stated, as you may make people's eyes transparent. I would definitely try to batch it in Photoshop/Gimp/etc.

windows 8 metro app designing for multiple Resolution

I am designing a simple music app where the user gets to play instruments i.e. Drums, and the problem that I am facing is with resolutions.
The drums are images, which I have converted them into buttons. Everything looks great at the state that I have designed it.
However, when I switch to other resolution states, the button(image) are distorted, e.g. skewed, scaled, and looks nasty.
I have tried designing or arranging them via selecting 'Enable state Recording', but the specific designs for that state are not being saved.
Have you tried the approaches discussed here? http://msdn.microsoft.com/en-us/library/windows/apps/hh465362.aspx For the actual button sizes, make sure you are not fixing the width/height with pixel values. Use * weighted rows and columns to layout your grids and have the buttons autosize to fill a given cell in the grid. Then match with the appropriate image resource per the article.
Grids are great for dividing up available space but they can't account for changes in aspect ratios. If your items are still set to Stretch (or Fill) then they can end up out of aspect ratio. Another option is to design the entire layout at a fixed size (let's say 1024 x 768 or 1366 x 768) and wrap the entire thing in a ViewBox. ViewBox will scale all elements equally and maintain the aspect ratio, adding letterboxing (or empty space) on the sides / top & bottom if necessary. This might be a better approach for a drum kit.
Hope that helps.
Redid the whole project of designing again.
This time, I put the image inside a specific grid and that made things lot better. :)