Search Results

Search found 603 results on 25 pages for 'rgb'.

Page 4/25 | < Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >

  • Calculating rgb vals for BufferedImage

    - by Hamza Yerlikaya
    I am using following snippet to build a 32 bit integer to use with setRGB of BufferedImage (bit-or (bit-shift-left a 24) (bit-or (bit-shift-left r 16) (bit-or (bit-shift-left g 8) b))) after writing colors reading them back reveals wrong colors is there a fault in my logic?

    Read the article

  • How to deal with RGB to YUV conversion

    - by maximus
    The formula says: Y = 0.299 * R + 0.587 * G + 0.114 * B; U = -0.14713 * R - 0.28886 * G + 0.436 * B; V = 0.615 * R - 0.51499 * G - 0.10001 * B; What if, for example, the U variable becomes negative? U = -0.14713 * R - 0.28886 * G + 0.436 * B; Assume maximum values for R and G (ones) and B = 0 So, I am interested in implementing this convetion function in OpenCV, So, how to deal with negative values? Using float image? anyway please explain me, may be I don't understand something..

    Read the article

  • Increase RGB components every Hour (r), Minute (g), Second (b) for digital clock

    - by TJ Fertterer
    So I am taking my first javascript class (total noob) and one of the assignments is to modify a digital clock by assigning the color red to hours, green minutes, blue to seconds, then increase the respective color component when it changes. I have successfully assigned a decimal color value (ex. "#850000" to each element (hours, minutes, seconds), but my brain is fried trying to figure out how to increase the brightness when hours, minutes, seconds change, i.e. red goes up to "#870000" changing from 1:00:00 pm to 2:00:00 pm. I've searched everywhere with no help on how to successfully do this. Here is what I have so far and any help on this would be greatly appreciated. TJ <script type="text/javascript"> <!-- function updateClock() { var currentTime = new Date(); var currentHours = currentTime.getHours(); var currentMinutes = currentTime.getMinutes(); var currentSeconds = currentTime.getSeconds(); // Pad the minutes with leading zeros, if required currentMinutes = ( currentMinutes < 10 ? "0" : "" ) + currentMinutes; // Pad the seconds with leading zeros, if required currentSeconds = ( currentSeconds < 10 ? "0" : "" ) + currentSeconds; // Choose either "AM" or "PM" as appropriate var timeOfDay = ( currentHours < 12 ) ? "AM" : "PM"; // Convert the hours component to 12-hour format currentHours = ( currentHours > 12 ) ? currentHours - 12 : currentHours; // Convert an hours component if "0" to "12" currentHours = ( currentHours == 0 ) ? 12 : currentHours; // Get hold of the html elements by their ids var hoursElement = document.getElementById("hours"); document.getElementById("hours").style.color = "#850000"; var minutesElement = document.getElementById("minutes"); document.getElementById("minutes").style.color = "#008500"; var secondsElement = document.getElementById("seconds"); document.getElementById("seconds").style.color = "#000085"; var am_pmElement = document.getElementById("am_pm"); // Put the clock sections text into the elements' innerHTML hoursElement.innerHTML = currentHours; minutesElement.innerHTML = currentMinutes; secondsElement.innerHTML = currentSeconds; am_pmElement.innerHTML = timeOfDay; } // --> </script> </head> <body onload="updateClock(); setInterval( 'updateClock()', 1000 )"> <h1 align="center">The JavaScript digital clock</h1> <h2 align="center">Thomas Fertterer - Lab 2</h2> <div id='clock' style="text-align: center"> <span id="hours"></span>: <span id='minutes'></span>: <span id='seconds'></span> <span id='am_pm'></span> </div> </body> </html>

    Read the article

  • Changing RGB color image to Grayscale image using Objective C

    - by user567167
    I was developing a application that changes color image to gray image. However, some how the picture comes out wrong. I dont know what is wrong with the code. maybe the parameter that i put in is wrong please help. UIImage *c = [UIImage imageNamed:@"downRed.png"]; CGImageRef cRef = CGImageRetain(c.CGImage); NSData* pixelData = (NSData*) CGDataProviderCopyData(CGImageGetDataProvider(cRef)); size_t w = CGImageGetWidth(cRef); size_t h = CGImageGetHeight(cRef); unsigned char* pixelBytes = (unsigned char *)[pixelData bytes]; unsigned char* greyPixelData = (unsigned char*) malloc(w*h); for (int y = 0; y < h; y++) { for(int x = 0; x < w; x++){ int iter = 4*(w*y+x); int red = pixe lBytes[iter]; int green = pixelBytes[iter+1]; int blue = pixelBytes[iter+2]; greyPixelData[w*y+x] = (unsigned char)(red*0.3 + green*0.59+ blue*0.11); int value = greyPixelData[w*y+x]; } } CFDataRef imgData = CFDataCreate(NULL, greyPixelData, w*h); CGDataProviderRef imgDataProvider = CGDataProviderCreateWithCFData(imgData); size_t width = CGImageGetWidth(cRef); size_t height = CGImageGetHeight(cRef); size_t bitsPerComponent = 8; size_t bitsPerPixel = 8; size_t bytesPerRow = CGImageGetWidth(cRef); CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceGray(); CGBitmapInfo info = kCGImageAlphaNone; CGFloat *decode = NULL; BOOL shouldInteroplate = NO; CGColorRenderingIntent intent = kCGRenderingIntentDefault; CGDataProviderRelease(imgDataProvider); CGImageRef throughCGImage = CGImageCreate(width, height, bitsPerComponent, bitsPerPixel, bytesPerRow, colorSpace, info, imgDataProvider, decode, shouldInteroplate, intent); UIImage* newImage = [UIImage imageWithCGImage:throughCGImage]; CGImageRelease(throughCGImage); newImageView.image = newImage;

    Read the article

  • glReadPixels() returning non-accurate value

    - by max
    I'm trying to implement the flood fill algorithm. But glReadPixels() is returning float RGB values of a pixel which are slightly different from the actual value set by me, causing the algorithm to fail. Why is this happening? Outputting returned RGB values to check. #include<iostream> #include<GL/glut.h> using namespace std; float boundaryColor[3]={0,0,0}, interiorColor[3]={0,0,0.5}, fillColor[3]={1,0,0}; float readPixel[3]; void init(void) { glClearColor(0,0,0.5,0); glMatrixMode(GL_PROJECTION); gluOrtho2D(0,500,0,500); } void setPixel(int x,int y) { glColor3fv(fillColor); glBegin(GL_POINTS); glVertex2f(x,y); glEnd(); } void getPixel(int x, int y, float *color) { glReadPixels(x,y,1,1,GL_RGB,GL_FLOAT,color); } void floodFill(int x,int y) { getPixel(x,y,readPixel); //outputting values here to check cout<<readPixel[0]<<endl; cout<<readPixel[1]<<endl; cout<<readPixel[2]<<endl; if( readPixel[0]==interiorColor[0] && readPixel[1]==interiorColor[1] && readPixel[2]==interiorColor[2] ) { setPixel(x,y); floodFill(x+1,y); floodFill(x,y+1); floodFill(x-1,y); floodFill(x,y-1); } } void display() { glClear(GL_COLOR_BUFFER_BIT); glColor3fv(boundaryColor); glLineWidth(3); glBegin(GL_LINE_STRIP); glVertex2i(150,150); glVertex2i(150,350); glVertex2i(350,350); glVertex2i(350,150); glVertex2i(150,150); glEnd(); floodFill(200,200); glFlush(); } int main(int argc,char** argv) { glutInit(&argc,argv); glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB); glutInitWindowPosition(100,100); glutInitWindowSize(500,500); glutCreateWindow("Flood fill"); init(); glutDisplayFunc(display); glutMainLoop(); }

    Read the article

  • Poll: CSS3 color transparency

    - by lepe
    Many of you already know that you can express colors in your stylesheets like: color: #FFF; color: #FFFFFF; color: rgb(255,255,255); color: hsl(100%,100%,100%); and that you can use rgba() and hsla() to express color transparency. Do you think it would be a good idea to be able to express color transparency in #RRGGBBAA or #RGBA annotation? Why YES, and why NOT??? Also if you want, give a little of details of how you perform your development (if you use a web-builder software, a graphic software (for designs), use vim, etc..)

    Read the article

  • Hex colors: Numeric representation for "transparent"?

    - by Pekka
    I am building a web CMS in which the user can choose colours for certain site elements. I would like to convert all colour values to hex to avoid any further formatting hassle ("rgb(x,y,z)" or named colours). I have found a good JS library for that. The only thing that I can't get into hex is "transparent". I need this when explicitly declaring an element as transparent, which in my experience can be different from not defining any value at all. Does anybody know whether this can be turned into some numeric form? Will I have to set up all processing instances to accept hex values or "transparent"? I can't think of any other way.

    Read the article

  • How to read and modify the colorspace of an image in c#

    - by Matthias
    I'm loading a Bitmap from a jpg file. If the image is not 24bit RGB, I'd like to convert it. The conversion should be fairly fast. The images I'm loading are up to huge (9000*9000 pixel with a compressed size of 40-50MB). How can this be done? Btw: I don't want to use any external libraries if possible. But if you know of an open source utility class performing the most common imaging tasks, I'd be happy to hear about it. Thanks in advance.

    Read the article

  • I'm looking for a blend mode that gives 'realistic' paint colors. (Subtractive)

    - by almosnow
    I've been looking for a blend mode to (well ...) blend two RGB pixels in order to build colors in the samw way that a painter builds them (i.e: subtractive). Here are quick examples of the type of results that I'm expecting: CYAN + MAGENTA = BLUE CYAN + YELLOW = GREEN MAGENTA + YELLOW = RED RED + YELLOW = ORANGE RED + BLUE = PURPLE YELLOW + BLUE = GREEN I'm looking for a formula, like: dest_red = first_red + second_red; dest_green = first_green + second_green; dest_blue = first_blue + second_blue; I've tried with the commonly used 'multiply' formula but it doesn't work; I've tried with custom made formulas but I'm still not able to 'crack' how it should work. And I know already a lot of color theory so please refrain from answers like: Check this link: http://the_difference_betweeen_additive_and_subtractive_lightning.html

    Read the article

  • Show RGB888 content

    - by Abhi
    Hi all! I have to show RGB888 content using the ShowRGBContent function. The below function is a ShowRGBContent function for yv12-rgb565 & UYVY-RGB565 static void ShowRGBContent(UINT8 * pImageBuf, INT32 width, INT32 height) { LogEntry(L"%d : In %s Function \r\n",++abhineet,WFUNCTION); UINT16 * temp; BYTE rValue, gValue, bValue; // this is to refresh the background desktop ShowWindow(GetDesktopWindow(),SW_HIDE); ShowWindow(GetDesktopWindow(),SW_SHOW); for(int i=0; i<height; i++) { for (int j=0; j< width; j++) { temp = (UINT16 *) (pImageBuf+ i*width*PP_TEST_FRAME_BPP+j*PP_TEST_FRAME_BPP); bValue = (BYTE) ((*temp & RGB_COMPONET0_MASK) >> RGB_COMPONET0_OFFSET) << (8 -RGB_COMPONET0_WIDTH); gValue = (BYTE) ((*temp & RGB_COMPONET1_MASK) >> RGB_COMPONET1_OFFSET) << (8 -RGB_COMPONET1_WIDTH); rValue = (BYTE) ((*temp & RGB_COMPONET2_MASK) >> RGB_COMPONET2_OFFSET) << (8 -RGB_COMPONET2_WIDTH); SetPixel(g_hDisplay, SCREEN_OFFSET_X + j, SCREEN_OFFSET_Y+i, RGB(rValue, gValue, bValue)); } } Sleep(2000); //sleep here to review the result LogEntry(L"%d :Out %s Function \r\n",++abhineet,__WFUNCTION__); } I have to modify this for RGB888 Here in the above function: ************************ RGB_COMPONET0_WIDTH = 5 RGB_COMPONET1_WIDTH = 6 RGB_COMPONET2_WIDTH = 5 ************************ ************************ RGB_COMPONET0_MASK = 0x001F //31 in decimal RGB_COMPONET1_MASK = 0x07E0 //2016 in decimal RGB_COMPONET2_MASK = 0xF800 //63488 in decimal ************************ ************************ RGB_COMPONET0_OFFSET = 0 RGB_COMPONET1_OFFSET = 5 RGB_COMPONET2_OFFSET = 11 ************************ Also PP_TEST_FRAME_BPP = 2 for yv12 -> RGB565 & UYVY -> RGB565 Now my task is for RGB888. Please guide me what shall i do in this. Thanks in advance.

    Read the article

  • ActionScript 3.0 Color Output Error?

    - by TheDarkIn1978
    I'm employing color in a current AS3 project, and have come across what appears to be an error in the Flash Player (version 10). it might also be an error with Apple's DigitalColor Meter (version 3.7.2), which is what i'm using to sample the displayed colors on Mac OS X Snow Leopard (version 10.6.3). //Primary, secondary, and tertiary colors of the RGB color wheel var red:Number = 0xFF0000; var orange:Number = 0xFF7D00; var yellow:Number = 0xFFFF00; var chartreuse:Number = 0x7DFF00; var green:Number = 0x00FF00; var spring:Number = 0x00FF7D; var cyan:Number = 0x00FFFF; var azure:Number = 0x007DFF; //reads 0x0077FF var blue:Number = 0x0000FF; var violet:Number = 0x7D00FF; var magenta:Number = 0xFF00FF; //reads 0xFF00F8 var rose:Number = 0xFF007D; //reads 0xFF0077 all of these colors display normally except for 3: Azure, Magenta and Rose. they are coded with the appropriate number, but when i use the color meter to sample the displayed colors, those 3 return inaccurate results. anyone have any insight about this issue? what is causing the error, the Flash runtime or the color sampler? if it's the Flash player, could this problem be much deeper? *sampling this image will return inaccurate results due to .jpg compression. it's simply for illustration

    Read the article

  • Conversion from YUV444 to RGB888

    - by Abhi
    I am new in this field and i desperately need some guidance from u all. I have to support yuv444 to rgb 888 in display driver module. There is one test which i have done for yv12 → rgb565 in wince 6.0 r3 which is mentioned below. //------------------------------------------------------------------------------ // // Function: PP_CSC_YV12_RGB565Test // // This function tests the Post-processor // // // // Parameters: // uiMsg // [in] Ignored. // // tpParam // [in] Ignored. // // lpFTE // [in] Ignored. // // Returns: // Specifies if the test passed (TPR_PASS), failed (TPR_FAIL), or was // skipped (TPR_SKIP). // // TESTPROCAPI PP_CSC_YV12_RGB565Test(UINT uMsg, TPPARAM tpParam, LPFUNCTION_TABLE_ENTRY lpFTE) { LogEntry(L"%d : In %s Function \r\n",++abhineet,__WFUNCTION__); UNREFERENCED_PARAMETER(tpParam); UNREFERENCED_PARAMETER(lpFTE); DWORD dwResult= TPR_SKIP; ppConfigData ppData; DWORD iInputBytesPerFrame, iOutputBytesPerFrame; UINT32 iInputStride, iOutputStride; UINT16 iOutputWidth, iOutputHeight, iOutputBPP; UINT16 iInputWidth, iInputHeight, iInputBPP; int iOption; PP_TEST_FUNCTION_ENTRY(); // Validate that the shell wants the test to run if (uMsg != TPM_EXECUTE) { return TPR_NOT_HANDLED; } PPTestInit(); iInputWidth = PP_TEST_FRAME_WIDTH; //116 iInputHeight = PP_TEST_FRAME_HEIGHT; //160 iInputBPP = PP_TEST_FRAME_BPP; //2 iInputStride = iInputWidth * 3/2; // YV12 is 12 bits per pixel iOutputWidth = PP_TEST_FRAME_WIDTH; iOutputHeight = PP_TEST_FRAME_HEIGHT; iOutputBPP = PP_TEST_FRAME_BPP; iOutputStride = iOutputWidth * iOutputBPP; // Allocate buffers for input and output frames iInputBytesPerFrame = iInputStride * iInputHeight; pInputFrameVirtAddr = (UINT32 *) AllocPhysMem(iInputBytesPerFrame, PAGE_EXECUTE_READWRITE, 0, 0, (ULONG *) &pInputFramePhysAddr); iOutputBytesPerFrame = iOutputStride * iOutputHeight; pOutputFrameVirtAddr = (UINT32 *) AllocPhysMem(iOutputBytesPerFrame, PAGE_EXECUTE_READWRITE, 0, 0, (ULONG *) &pOutputFramePhysAddr); if ((NULL == pInputFrameVirtAddr) || (NULL == pOutputFrameVirtAddr)) { dwResult = TPR_FAIL; goto PP_CSC_YV12_RGB565Test_clean_up; } //----------------------------- // Configure PP //----------------------------- // Set up post-processing configuration data memset(&ppData, 0 , sizeof(ppData)); // Set up input format and data width ppData.inputIDMAChannel.FrameFormat = icFormat_YUV420; ppData.inputIDMAChannel.DataWidth = icDataWidth_8BPP; // dummy value for YUV ppData.inputIDMAChannel.PixelFormat.component0_offset = 0; ppData.inputIDMAChannel.PixelFormat.component1_offset = 8; ppData.inputIDMAChannel.PixelFormat.component2_offset = 16; ppData.inputIDMAChannel.PixelFormat.component3_offset = 24; ppData.inputIDMAChannel.PixelFormat.component0_width = 8-1; ppData.inputIDMAChannel.PixelFormat.component1_width = 8-1; ppData.inputIDMAChannel.PixelFormat.component2_width = 8-1; ppData.inputIDMAChannel.PixelFormat.component3_width = 8-1; ppData.inputIDMAChannel.FrameSize.height = iInputHeight; ppData.inputIDMAChannel.FrameSize.width = iInputWidth; ppData.inputIDMAChannel.LineStride = iInputWidth; // Set up output format and data width ppData.outputIDMAChannel.FrameFormat = icFormat_RGB; ppData.outputIDMAChannel.DataWidth = icDataWidth_16BPP; ppData.outputIDMAChannel.PixelFormat.component0_offset = RGB_COMPONET0_OFFSET; ppData.outputIDMAChannel.PixelFormat.component1_offset = RGB_COMPONET1_OFFSET; ppData.outputIDMAChannel.PixelFormat.component2_offset = RGB_COMPONET2_OFFSET; ppData.outputIDMAChannel.PixelFormat.component3_offset = RGB_COMPONET3_OFFSET; ppData.outputIDMAChannel.PixelFormat.component0_width = RGB_COMPONET0_WIDTH -1; ppData.outputIDMAChannel.PixelFormat.component1_width = RGB_COMPONET1_WIDTH -1; ppData.outputIDMAChannel.PixelFormat.component2_width = RGB_COMPONET2_WIDTH -1; ppData.outputIDMAChannel.PixelFormat.component3_width = RGB_COMPONET3_WIDTH; ppData.outputIDMAChannel.FrameSize.height = iOutputHeight; ppData.outputIDMAChannel.FrameSize.width = iOutputWidth; ppData.outputIDMAChannel.LineStride = iOutputStride; // Set up post-processing channel CSC parameters // based on input and output ppData.CSCEquation = CSCY2R_A1; ppData.inputIDMAChannel.UBufOffset = iInputHeight * iInputWidth + (iInputHeight * iInputWidth)/4; ppData.inputIDMAChannel.VBufOffset = iInputHeight * iInputWidth; ppData.FlipRot.verticalFlip = FALSE; ppData.FlipRot.horizontalFlip = FALSE; ppData.FlipRot.rotate90 = FALSE; if (!PPConfigure(hPP, &ppData)) { dwResult = TPR_FAIL; goto PP_CSC_YV12_RGB565Test_clean_up; } //----------------------------- // Read first input buffer //----------------------------- // Read Input file for new frame if (!ReadImage(PP_TEST_YV12_FILENAME,pInputFrameVirtAddr,iInputBytesPerFrame,PP_TEST_FRAME_WIDTH,PP_TEST_FRAME_HEIGHT)) { g_pKato->Log(PP_ZONE_ERROR, (TEXT("fail to ReadImage()!\r\n"))); dwResult = TPR_FAIL; goto PP_CSC_YV12_RGB565Test_clean_up; } //----------------------------- // Start PP //----------------------------- if (!PPStart(hPP)) { dwResult = TPR_FAIL; goto PP_CSC_YV12_RGB565Test_clean_up; } if (!PPInterruptEnable(hPP, FRAME_INTERRUPT)) { dwResult = TPR_FAIL; goto PP_CSC_YV12_RGB565Test_clean_up; } //----------------------------- // Queue Input/Output Buffers //----------------------------- UINT32 starttime = GetTickCount(); // Add input and output buffers to PP queues. if (!PPAddInputBuffer(hPP, (UINT32) pInputFramePhysAddr)) { dwResult = TPR_FAIL; goto PP_CSC_YV12_RGB565Test_clean_up; } if (!PPAddOutputBuffer(hPP,(UINT32) pOutputFramePhysAddr)) { dwResult = TPR_FAIL; goto PP_CSC_YV12_RGB565Test_clean_up; } if (!PPWaitForNotBusy(hPP, FRAME_INTERRUPT)) { dwResult = TPR_FAIL; goto PP_CSC_YV12_RGB565Test_clean_up; } RETAILMSG(1, (TEXT("===========FLIP TIME: %dms====== \r\n"), GetTickCount()-starttime)); //----------------------------- // Stop PP //----------------------------- if (!PPStop(hPP)) { dwResult = TPR_FAIL; goto PP_CSC_YV12_RGB565Test_clean_up; } if (!PPClearBuffers(hPP)) { dwResult = TPR_FAIL; goto PP_CSC_YV12_RGB565Test_clean_up; } ShowRGBContent((UINT8 *) pOutputFrameVirtAddr, PP_TEST_FRAME_WIDTH, PP_TEST_FRAME_HEIGHT); iOption = MessageBox( NULL,TEXT("After CSC(YV12->RGB565). Is it correct?"),TEXT("Test result"),MB_YESNO ); if ( IDNO == iOption ) { dwResult = TPR_FAIL; } else { dwResult = TPR_PASS; } PP_CSC_YV12_RGB565Test_clean_up: if(NULL != pInputFrameVirtAddr) { FreePhysMem( pInputFrameVirtAddr ); pInputFrameVirtAddr = NULL; } if(NULL != pOutputFrameVirtAddr) { FreePhysMem( pOutputFrameVirtAddr ); pOutputFrameVirtAddr = NULL; } PPTestDeInit(); LogEntry(L"%d :Out %s Function \r\n",++abhineet,__WFUNCTION__); return dwResult; } The below is the flow for this function. It tells the start and end of this test. *** vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv *** TEST STARTING *** *** Test Name: PP CSC(YV12-RGB565) Test *** Test ID: 500 *** Library Path: pp_test.dll *** Command Line: *** Kernel Mode: Yes *** Random Seed: 24421 *** Thread Count: 0 *** vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv *******Abhineet-PPTEST : 338 : In ShellProc Function *******Abhineet-PPTEST : 339 : In Debug Function PP_TEST: ShellProc(SPM_BEGIN_TEST, ...) called *******Abhineet-PPTEST : 340 :Out Debug Function BEGIN TEST: "PP CSC(YV12-RGB565) Test", Threads=0, Seed=24421 *******Abhineet-PPTEST : 341 :Out ShellProc Function *******Abhineet-PPTEST : 342 : In PP_CSC_YV12_RGB565Test Function PP_CSC_YV12_RGB565Test *******Abhineet-PPTEST : 343 : In PPTestInit Function *******Abhineet-PPTEST : 344 : In GetPanelDimensions Function *******Abhineet-PPTEST : 345 :Out GetPanelDimensions Function GetPanelDimensions: width=1024 height=768 bpp=16 *******Abhineet-PPTEST : 346 :Out PPTestInit Function *******Abhineet-PPTEST : 347 : In ReadImage Function RELFSD: Opening file flags_112x160.yv12 from desktop *******Abhineet-PPTEST : 348 :Out ReadImage Function ===========FLIP TIME: 1ms====== *******Abhineet-PPTEST : 349 : In ShowRGBContent Function *******Abhineet-PPTEST : 350 :Out ShowRGBContent Function *******Abhineet-PPTEST : 351 : In PPTestDeInit Function *******Abhineet-PPTEST : 352 :Out PPTestDeInit Function *******Abhineet-PPTEST : 353 :Out PP_CSC_YV12_RGB565Test Function *******Abhineet-PPTEST : 354 : In DllMain Function *******Abhineet-PPTEST : 355 :Out DllMain Function *******Abhineet-PPTEST : 356 : In ShellProc Function *******Abhineet-PPTEST : 357 : In Debug Function PP_TEST: ShellProc(SPM_END_TEST, ...) called *******Abhineet-PPTEST : 358 :Out Debug Function END TEST: "PP CSC(YV12-RGB565) Test", PASSED, Time=6.007 *******Abhineet-PPTEST : 359 :Out ShellProc Function *** ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ *** TEST COMPLETED *** *** Test Name: PP CSC(YV12-RGB565) Test *** Test ID: 500 *** Library Path: pp_test.dll *** Command Line: *** Kernel Mode: Yes *** Result: Passed *** Random Seed: 24421 *** Thread Count: 1 *** Execution Time: 0:00:06.007 *** ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Please help me out to make changes to the above function for yuv444-rgb888.

    Read the article

  • CSS3 - Validator - RGBA wrong?

    - by poru
    I'm using the W3C CSS Validator with the Profile CSS3 but the validator says that my CSS rgba()'s are wrong. I looked up the Color Module Level 3, and the syntax is the same as mine. I also tried the Dev-Validator, same result. Example input: div.class { border: 1px solid rgba(0, 0, 0, 0.5); } Am I wrong or why does the validator say that I have that many mistakes with rgba?

    Read the article

  • How does one convert 16-bit RGB565 to 24-bit RGB888?

    - by jleedev
    I’ve got my hands on a 16-bit rgb565 image (specifically, an Android framebuffer dump), and I would like to convert it to 24-bit rgb888 for viewing on a normal monitor. The question is, how does one convert a 5- or 6-bit channel to 8 bits? The obvious answer is to shift it. I started out by writing this: uint16_t buf; while (read(0, &buf, sizeof buf)) { unsigned char red = (buf & 0xf800) >> 11; unsigned char green = (buf & 0x07c0) >> 5; unsigned char blue = buf & 0x003f; putchar(red << 3); putchar(green << 2); putchar(blue << 3); } However, this doesn’t have one property I would like, which is for 0xffff to map to 0xffffff, instead of 0xf8fcf8. I need to expand the value in some way, but I’m not sure how that should work. The Android SDK comes with a tool called ddms (Dalvik Debug Monitor) that takes screen captures. As far as I can tell from reading the code, it implements the same logic; yet its screenshots are coming out different, and white is mapping to white. Here’s the raw framebuffer, the smart conversion by ddms, and the dumb conversion by the above algorithm. (By the way, this conversion is implemented in ffmpeg, but it’s just performing the dumb conversion listed above, leaving the LSBs at all zero.) I guess I have two questions: What’s the most sensible way to convert rgb565 to rgb888? How is DDMS converting its screenshots?

    Read the article

  • Java image conversion to RGB565

    - by Vladimir
    I try to convert image to RGB565 format. I read this image: BufferedImage bufImg = ImageIO.read(imagePathFile); sendImg = new BufferedImage(CONTROLLER_LCD_WIDTH/*320*/, CONTROLLER_LCD_HEIGHT/*240*/, BufferedImage.TYPE_USHORT_565_RGB); sendImg .getGraphics().drawImage(bufImg, 0, 0, CONTROLLER_LCD_WIDTH/*320*/, CONTROLLER_LCD_HEIGHT/*240*/, null); Here is it: Then I convert it to RGB565: int numByte=0; byte[] OutputImageArray = new byte[CONTROLLER_LCD_WIDTH*CONTROLLER_LCD_HEIGHT*2]; int i=0; int j=0; int len = OutputImageArray.length; for (i=0;i<CONTROLLER_LCD_WIDTH;i++) { for (j=0;j<CONTROLLER_LCD_HEIGHT;j++) { Color c = new Color(sendImg.getRGB(i, j)); int aRGBpix = sendImg.getRGB(i, j); int alpha; int red = c.getRed(); int green = c.getGreen(); int blue = c.getBlue(); //RGB888 red = (aRGBpix >> 16) & 0x0FF; green = (aRGBpix >> 8) & 0x0FF; blue = (aRGBpix >> 0) & 0x0FF; alpha = (aRGBpix >> 24) & 0x0FF; //RGB565 red = red >> 3; green = green >> 2; blue = blue >> 3; //A pixel is represented by a 4-byte (32 bit) integer, like so: //00000000 00000000 00000000 11111111 //^ Alpha ^Red ^Green ^Blue //Converting to RGB565 short pixel_to_send = 0; int pixel_to_send_int = 0; pixel_to_send_int = (red << 11) | (green << 5) | (blue); pixel_to_send = (short) pixel_to_send_int; //dividing into bytes byte byteH=(byte)((pixel_to_send >> 8) & 0x0FF); byte byteL=(byte)(pixel_to_send & 0x0FF); //Writing it to array - High-byte is second OutputImageArray[numByte]=byteH; OutputImageArray[numByte+1]=byteL; numByte+=2; } } Then I try to restore this from resulting array OutputImageArray: i=0; j=0; numByte=0; BufferedImage NewImg = new BufferedImage(CONTROLLER_LCD_WIDTH, CONTROLLER_LCD_HEIGHT, BufferedImage.TYPE_USHORT_565_RGB); for (i=0;i<CONTROLLER_LCD_WIDTH;i++) { for (j=0;j<CONTROLLER_LCD_HEIGHT;j++) { int curPixel=0; int alpha=0x0FF; int red; int green; int blue; byte byteL=0; byte byteH=0; byteH = OutputImageArray[numByte]; byteL = OutputImageArray[numByte+1]; curPixel= (byteH << 8) | (byteL); //RGB565 red = (curPixel >> (6+5)) & 0x01F; green = (curPixel >> 5) & 0x03F; blue = (curPixel) & 0x01F; //RGB888 red = red << 3; green = green << 2; blue = blue << 3; //aRGB curPixel = 0; curPixel = (alpha << 24) | (red << 16) | (green << 8) | (blue); NewImg.setRGB(i, j, curPixel); numByte+=2; } } I output this restored image. But I see that it looks very poor. I expected the lost of pictures quality. But as I thought, this picture has to have almost the same quality as the previous picture. - Is it right? Is my code right?

    Read the article

  • Stable random color algorithm

    - by Olmo
    Here we have an interesting real-world algorithm requirement involving colors. 1) Nice random colors: In ordeeing to draw a beautifull chart (i.e: pie chart) we need to pick a random set of Colors that: a) are different enought b) Play nicely Doesnt Look hard. For example u fix bright and saturation and divide hue in steps of 360/Num_sectors 2) Stable: given Pie1 with sectors with labes ('A','B','C') and Pie2 with sector with labels ('B','C','D'), will be nice if color('B',pie1)= color('B',pie2) and the same for 'C' and so on, so people don't get crazy when seeing similar updated charts, even if some sectors appear some dissapeared or the number of sectors changed. The label is the only stable thing. 3) hard-coded colors: the algorithm allows hardcoded label-color relationships as an input but stills doing a good work (1 & 2) for the rest of free labels. I think this algorithm, even if it looks quite ad-hoc, will be usefull in more then one situation. Any ideas?

    Read the article

  • Creating Bitmaps from ARGB strings (in actionscript-3)???

    - by ashenwraith
    Hi, in actionscript 3, what's the fastest way to dump your data (not from a file) into a bitmap for display? I have it working with setPixels and colored rects but that's way too slow/inefficient. Is there a way to load in the raw bytes or hijack the loader class to put in custom loader data? What would be the best/fastest--should I start writing a byte encoder?

    Read the article

  • Condensing multiple else if statements, referencing them from a table?

    - by Haskella
    Hi I'm about to type some 500 else if statements into my code (PHP) which have the exact same coding each: if (color=White); rgb = 255-255-255; print rgb; else if (color=Black); rgb = 0-0-0; print rgb; else if (color=Red); rgb = 255-0-0; print rgb; else if (color=Blue); rgb = 0-0-255; print rgb; [the list keeps going] I also (luckily) have a table that displays the color in the first column and rgb value in the next column for 500 of them... how do I use this to save time typing all those else if statements? Some how I have to reference the table file (made in excel, I'm guessing I'll have to save it as .csv?)

    Read the article

  • How do I draw a filled circle onto a graphics object in a hexadecimal colour?

    - by George Powell
    I need to draw a circle onto a bitmap in a specific colour given in Hex. The "Brushes" class only gives specific colours with names. Bitmap bitmap = new Bitmap(20, 20); Graphics g = Graphics.FromImage(bitmap); g.FillEllipse(Brushes.AliceBlue, 0, 0, 19, 19); //The input parameter is not a Hex //g.FillEllipse(new Brush("#ff00ffff"), 0, 0, 19, 19); <<This is the kind of think I need. Is there a way of doing this? The exact problem: I am generating KML (for Google earth) and I am generating lots of lines with different Hex colours. The colours are generated mathematically and I need to keep it that way so I can make as many colours as I want. I need to generate a PNG icon for each of the lines that is the same colour exactly.

    Read the article

  • Changing the tint of a bitmap while preserving the overall brightness

    - by MusiGenesis
    I'm trying to write a function that will let me red-shift or blue-shift a bitmap while preserving the overall brightness of the image. Basically, a fully red-shifted bitmap would have the same brightness as the original but be thoroughly red-tinted (i.e. the G and B values would be equal for all pixels). Same for blue-tinting (but with R and G equal). The degree of spectrum shifting needs to vary from 0 to 1. Thanks in advance.

    Read the article

  • XImage - how to resize?

    - by Ajan
    I've got an XImage retrieved by XShmGetImage function. How can I resize it? Is there any function in X11 libraries to perform this operation or I need to use external library?

    Read the article

  • Populating a color array with every 8th pixel in an image. C#

    - by Piper
    I have an image that is 512x280 pixels. I want to populate a 64x35 array with every 8th pixel in the matrix. Here is what I have right now: Color[,] imgArray = new Color[b.Width, b.Height]; for (int y = 0; y < 35; y++) { for (int x = 0; x < 64; x++) { imgArray[x, y] = b.GetPixel(x, y); } } But that will get just the top corner of the image. How would I change the loop so it grabs every 8th pixel to fill the array with? edit: I think I may have gotten it. Can someone read this and assure me that it is correct? Color[,] imgArray = new Color[64, 35]; for (int y = 0; y < 280; y+=8) { for (int x = 0; x < 512; x+=8) { imgArray[x, y] = b.GetPixel(x, y); } }

    Read the article

< Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >