pixel

drawRect unit issues android

佐手、 提交于 2019-12-11 01:01:22
问题 I am trying to keep track of the bounding Rect for a child TextView inside of a class extending LinearLayout I am using View.getGlobalVisibleRect(Rect) in order to get the TextView's bounding box relative to its parent. It works great on some devices, but there is obviously some kind of unit issue going on on other phones. Simple example of what I'm seeing: //Extended LinearLayout's onDraw protected void onDraw(Canvas canvas){ super.onDraw(canvas); TextView tv = (TextView)findViewById(R.id

Finding pixel on sprite in Unity

寵の児 提交于 2019-12-10 22:41:58
问题 In Unity3d we have RaycastHit.textureCoord but it doesn't exist anymore in 2D. I was searching about this problem, a lot but I didn't find anything useful. So I want to know the solution for this problem and I'm wondering why method like textureCoord in 3D doesn't exist in 2D actually in RaycastHit2D . also I want to access to the pixel when mouse cursor on it. 回答1: It works in 3D because RaycastHit.textureCoord requires a mesh collider. In the 2D case it is way simplee because you can

How to print out a pixel value in a Mat image

旧时模样 提交于 2019-12-10 19:35:17
问题 I have a question about how to cout a pixel value in an image. For example: I have image and size is 10*10, I want to cout the pixel value at row 5 and column 5 in the image, here is what I code. Mat img; cout << img.at<uchar>(5,5) << endl; But the result is in the following image I'm wondering why it prints such strange symbol? Can anyone help me? Thanks a lot!!!! 回答1: You are printing char value. So the value will translate into ANSI representation of that value. If you want to see a number

If Image contains specific color then

ぐ巨炮叔叔 提交于 2019-12-10 18:43:16
问题 Exists a easy way to check if a image contains certain rgb color? For example: Dim img As Image = Image.FromFile("C:\image.png") If img.contains color.red(.toRGB) then... I think the hard way to check this is by getting the color value of each pixel of the image, excluding the transparency of the pngs... also that technique I think will take a longer amount of time to process the entire image... but anyway I don't know how to do that too. UPDATE Tried this, but it sayd i'm trying to read from

Huge negative values extracted by using getPixel() method

孤街醉人 提交于 2019-12-10 16:43:07
问题 I am having a problem with an image processing app I am developing (newbie here). I am trying to extract the value of specific pixels by using the getPixel() method. I am having a problem though. The number I get from this method is a huge negative number, something like -1298383. Is this normal? How can I fix it? Thanks. 回答1: I'm not an expert, but to me it looks like you are getting the hexadecimal value. Perhaps you want something more understandable like the value of each RGB layer. To

How to programmatically (preferably using PIL in python) calculate the total number of pixels of an object with a stripped background?

只谈情不闲聊 提交于 2019-12-10 16:27:57
问题 I have multiple pictures, each of which has an object with its background removed. The pictures are 500x400 pixels in size. I am looking for a way to programmatically (preferably using python) calculate the total number of pixels of the image inside the picture (inside the space without the background). I used the PIL package in Python to get the dimensions of the image object, as follows: print(image.size) This command successfully produced the dimensions of the entire picture (500x400

How to detect color of the center of camera streaming in android without OpenCV

孤人 提交于 2019-12-10 12:06:31
问题 Any approach to detect color of the center of image after starting camera preview ? (My problem is solved thanks for help) I've just developed a solution to detect average color of a stream of data of image taken with android camera. Here is my code, I trying to take image each 500 ms and crop the center (square of 60*60) then get average of color. public class TakePicture extends Activity implements SurfaceHolder.Callback { // a variable to store a reference to the Image View at the main.xml

iOS retrieve different pixels in pixel by pixel comparison of UIImages

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-10 11:41:02
问题 I am trying to do a pixel by pixel comparison of two UIImages and I need to retrieve the pixels that are different. Using this Generate hash from UIImage I found a way to generate a hash for a UIImage. Is there a way to compare the two hashes and retrieve the different pixels? 回答1: If you want to actually retrieve the difference, the hash cannot help you. You can use the hash to detect the likely presence of differences, but to get the actual differences, you have to use other techniques. For

Adjusting image intensity values

半腔热情 提交于 2019-12-10 11:38:16
问题 I came to the imadjust function in MATLAB . It seems that this function enhances the contrast of the image. But, what is the theoretical basis for this function? In other words, if I say that this function as mentioned in the documentation adjusts the image intensity values, what does this exactly mean? What is it doing to the intensity values? Thanks. 回答1: The formula for each pixel is likely to be J = ((((I - low_in) / (high_in - low_in)) ^ gamma) * (high_out - low_out)) + low_out If you