logo
Tags down

shadow

Problem in understanding how colors are applied to each pixel


By : DonghwanKim
Date : September 16 2020, 04:00 AM
seems to work fine In this concept there is a subtle relationship between time and pixel positions.
As far as I know: This kind of heatmap is for involving Time in your image. The purpose is to show the movement of a moving object which is captured by a video, in only one image, so every pixel of the image that is related to the fixed (unmoving) objects of the scene (like background pixels) get to be zero (black). In contrast, if in the video, the moving object pass from a pixel position, that corresponding pixel in the image, will be colorful and it's color depends on the number (time) of the frame that moving object has been seen in the pixel.
code :
T=10 # 10 frames

pixel (1,1) got the white ball at frame 1 so its color would be ((0/9),1-(0/9)) which means the green channel has a zero value in that pixels and the red channel has 1 value so this pixel looks completely red.

pixel (1,2) got the white ball at frame 2 so its color would be (1/9 , 8/9), and  this pixels is more red than green.

... # continue so on for other 7 pixels

pixel (1,10) got the white ball at frame 2 so its color would be (1 , 0), and  this pixels is completely green.


Share : facebook icon twitter icon

Programmatically swap colors from a loaded bitmap to Red, Green, Blue or Gray, pixel by pixel


By : user2612035
Date : March 29 2020, 07:55 AM
I think the issue was by ths following , I have no idea what you are trying to achieve. First, what does the question have to do with equivalence relations?
Secondly, the code
code :
function RGBToRed(RGBColor: TColor): TColor;
var
  Red: Byte;
begin
  // Not sure of the algorithm for this color
  Result := RGB(Red, Red, Red);
end;
grey := (GetRValue(Color) + GetGValue(Color) + GetBValue(Color)) div 3;
function RGBToRed(RGBColor: TColor): TColor;
begin
  Result := RGB(GetRValue(RGBColor), 0, 0);
end;
function RGBToGreen(RGBColor: TColor): TColor;
begin
  Result := RGB(0, GetGValue(RGBColor), 0);
end;
function RGBToBlue(RGBColor: TColor): TColor;
begin
  Result := RGB(0, 0, GetBValue(RGBColor));
end;
function RGBToHSV(const Color: TRGB): THSV;
var
  cmax, cmin, cdiff: real;
begin
  cmax := MaxComponent(Color);
  cmin := MinComponent(Color);
  cdiff := cmax - cmin;

  with Color, result do
  begin

    // Hue
    if cmax = cmin then
      hsvHue := 0
    else if cmax = rgbRed then
      hsvHue := (60 * (rgbGreen - rgbBlue) / cdiff)
    else if cmax = rgbGreen then
      hsvHue := (60 * (rgbBlue - rgbRed) / cdiff) + 120
    else
      hsvHue := (60 * (rgbRed - rgbGreen) / cdiff) + 240;

    hsvHue := Fix360(hsvHue);

    // Saturation
    if cmax = 0 then
      hsvSaturation := 0
    else
      hsvSaturation := 1 - cmin / cmax;

    // Value
    hsvValue := cmax;

  end;

end;
function HSVToRGB(const Color: THSV): TRGB;
var
  hi: integer;
  f, q, p, t: real;
begin

  with Color do
  begin

    hi := floor(hsvHue / 60) mod 6;
    f := hsvHue / 60 - floor(hsvHue / 60);
    p := hsvValue * (1 - hsvSaturation);
    q := hsvValue * (1 - f * hsvSaturation);
    t := hsvValue * (1 - (1 - f) * hsvSaturation);

    case hi of
      0: result := RGB(hsvValue, t, p);
      1: result := RGB(q, hsvValue, p);
      2: result := RGB(p, hsvValue, t);
      3: result := RGB(p, q, hsvValue);
      4: result := RGB(t, p, hsvValue);
      5: result := RGB(hsvValue, p, q);
    end;

  end;

end;
type
  TRGB = record
    rgbRed,            // red intensity between 0 and 1
    rgbGreen,          // green intensity between 0 and 1
    rgbBlue: double;   // blue intensity between 0 and 1
  end;

  THSV = record
    hsvHue,            // hue angle between 0 and 360
    hsvSaturation,     // saturation between 0 (grey) and 1 (full colour)
    hsvValue: double;  // value between 0 (dark) and 1 ("normal")
  end;
function SwapBlueGreen(Color: TColor): TColor;
begin
  result := RGB(GetRValue(Color), GetBValue(Color), GetGValue(Color));
end;

Programmatically swap colors from a small bitmap (original), pixel by pixel


By : Zhou Yang
Date : March 29 2020, 07:55 AM
hope this fix your issue The question is still not well-defined, because grey doesn't work like any other colour (neither in the RGB model, nor in the HSV model), so there is no single, obvious way to implement the other colour buttons.
However, one natural way (maybe the most natural way) is to do as I suggested in my answer to the previous question, namely to convert each pixel from HSV(h, s, v) to HSV(0, s, v) in the red case, HSV(120, s, v) in the green case, and HSV(240, s, v) in the blue case. The numbers 0, 120, and 240 are the angles of the hue.

How to add colors into pixel by pixel on image on iphone?


By : Ranjan Dash
Date : March 29 2020, 07:55 AM
wish help you to fix your issue This thread answers the question:
http://www.iphonedevsdk.com/forum/iphone-sdk-development/34247-cgimage-pixel-array.html
code :
//create drawing context
UIGraphicsBeginImageContextWithOptions(CGSizeMake(width, height), NO, 0.0f);
CGContextRef context = UIGraphicsGetCurrentContext();  

//draw pixels
for (int x = 0; x < width; x++)
{
   for (int y = 0; y < height; y++)
   {
      CGContextSetFillColor( ... your color here ... );
      CGContextFillRect(context, CGRectMake(x, y, 1.0f, 1.0f));
   }
}

//capture resultant image
UIImage *image = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();

How to compare pixel colors


By : cleanestbuffalo
Date : March 29 2020, 07:55 AM
I wish did fix the issue. Sounds like you're looking towards color quantization. Everyone can see a different " identical. " as far as I know there's no pleasing everyone.
An Overview of Color Quantization Techniques

1 pixel is not 1 pixel when scaling is applied


By : Trifa
Date : March 29 2020, 07:55 AM
it fixes the issue
What I am using this for is completely irrelevant. Why do you guys care SO MUCH about what my use case is? It's my question and you guys should not care about what I am going to use it for
shadow
Privacy Policy - Terms - Contact Us © 35dp-dentalpractice.co.uk