paint

Draw on webcam using OpenCV

时光怂恿深爱的人放手 提交于 2019-11-26 21:50:09
问题 I want to draw/paint on a webcam screen using OpenCV. Since I'm reading from a cam, the frames are constantly changing, so I'm trying to figure out a way to keep or save the drawing on the current frame and use it for the next frame. The code below allows you to draw on the screen but when it gets the next frame, the drawing is gone and it starts over. Could someone please help me ... Thanks. CvCapture *input; input = cvCaptureFromCAM( 0 ); cvSetMouseCallback("Demo",&on_mouse, 0); for(;;) {

Mixing two RGB color vectors to get resultant

左心房为你撑大大i 提交于 2019-11-26 21:14:04
问题 I am trying to mix two source RGB vectors to create a third "resultant vector" that is an intuitive mix of the first two. Ideally, I would be able to emulate "real paint mixing characteristics", but for simplicity, I am trying to find a method where the resultant looks intuitively like what you'd get from combining the two source rgb's. minimally, these characteristics: RED + BLACK = DARK RED RED + WHITE = LIGHT RED optimally, also with real paint characteristics: RED + BLUE = PURPLE RED +

Problems with Java's Paint method, ridiculous refresh velocity

|▌冷眼眸甩不掉的悲伤 提交于 2019-11-26 21:07:33
I'm developing a very simple version of R-Type as work for the university, but despite it works, the craft velocity is a lot of slow, so the movement is ugly and clumsy. I use the method repaint for refresh the screen, there are others methods or ways best than it? Video of Movement Paint method at main Panel @Override public void paint(Graphics g) { super.paint(g); Graphics2D g2 = (Graphics2D) g; g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); g2.drawImage(fondo, 0, 0,1200,600,this); pj.paint(g2); g2D=g2; } PJ's paint method public void paint

Taking Screenshot

余生颓废 提交于 2019-11-26 20:28:35
问题 I'm developing an application for taking screenshots in the device. In this application, we can draw anything on the screen. For this I am using Canvas, Paint and Path to do this. I'm using this code to take screenshots: public void saveScreenshot() { if (ensureSDCardAccess()) { Bitmap bitmap = Bitmap.createBitmap(getWidth(), getHeight(), Bitmap.Config.ARGB_8888); Canvas canvas = new Canvas(bitmap); onDraw(canvas); File file = new File(mScreenshotPath + "/" + System.currentTimeMillis() + "

paint() in java applet is called twice for no reason

巧了我就是萌 提交于 2019-11-26 18:39:37
问题 Is there a common reason why the paint() method may be called twice without being intended. I have the following code: public void paint(Graphics g) { //Graphics2D gg; //gg=(Graphics2D) g; drawMatrix(g); } private void drawMatrix(Graphics g) { int side = 40; hex hexagon=new hex(); for(int i = 0; i<9; i++) for(int k = 0; k<9; k++){ g.setColor(Color.lightGray); g.fill3DRect(i*side,k*side, side, side, true); if (matrix[i][k]!=null){System.out.println("i is "+i+" k is "+k); g.setColor(Color.black

How to get the pixel color on touch?

删除回忆录丶 提交于 2019-11-26 18:36:49
I know this is a common question and there are a lot of answers of this question. I've used some of this. Although many of them are the same. But the sad thing for me is that none of them worked for me. The following codes i've used till now. -(void)getRGBAsFromImage:(UIImage*)image atX:(int)xx andY:(int)yy { // First get the image into your data buffer CGImageRef imageRef = [image CGImage]; NSUInteger width = CGImageGetWidth(imageRef); NSUInteger height = CGImageGetHeight(imageRef); CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB(); unsigned char *rawData = (unsigned char*) calloc

Why is paint()/paintComponent() never called?

淺唱寂寞╮ 提交于 2019-11-26 18:29:11
问题 For the last two days I have tried to understand how Java handles graphics, but have failed miserably at just that. My main problem is understanding exactly how and when paint() (or the newer paintComponent() ) is/should be called. In the following code I made to see when things are created, the paintComponent() is never called, unless I manually add a call to it myself or calls to JFrame.paintAll()/JFrame.paintComponents(). I renamed the paint() method to paintComponent() in hoping that

Why not to draw directly inside JFrame [duplicate]

南笙酒味 提交于 2019-11-26 17:22:46
问题 This question already has answers here : Difference between paint() and paintcomponent()? (2 answers) Closed 5 years ago . Can anyone explain me why shouldn't i use paint method to draw directly inside a JFrame window, and i should use paintComponent method with a JPanel inside the JFrame ? Thanks in advance. 回答1: Three main reasons... Top level containers aren't double buffered, which cause flickering when the frame is repainted, yes, you can implement you're own double buffering, but...

paint() and repaint() in Java

一世执手 提交于 2019-11-26 16:33:48
问题 I've spent maybe the last two hours browsing and reading up on these methods and the Graphics class, and maybe I'm stupid, haha, but I'm just not understanding them. What are they for? I understand that they're supposed redraw or update components on the screen, but I have never understood why this is required (I'm new to this). For example, if I'm moving a JLabel around the screen, a call to setLocation() moves it just fine. Is that a scenario in which repaint() isn't required? In which

How to improve painting performance of DataGridView?

二次信任 提交于 2019-11-26 14:07:26
问题 (sorry for bad English) I have a big problem with performance of DataGridView when it re-paints. I'm using a DataGridView to show logs from an external application stream. Messages from the stream come in with a high frequency (less than 1 ms). If I add new row to the DataGridView immediately when each new message comes, the DataGridView doesn't have time to re-paint itself before the next message comes. A possible solution is to use a queue to collect messages and re-paint DataGridView every