graphics

How do I display the red channel of an image in Matlab?

你。 提交于 2019-12-20 12:28:27
问题 I have a 3D matrix im which represents an RGB image. I can do imshow(im) to display the image. I want to display only one of the RGB channels at a time: I want to display the red channel and I want it to appear red. I've tried imshow(im(:,:,1)) but it displays the grayscale image (which is not what I want). How do I display the red channel and make it appear red? 回答1: I have three proposals for you. 1. Use the imagesc function and choose a red color palette. 2. Clear the other color channels:

Avoiding Calls to floor()

帅比萌擦擦* 提交于 2019-12-20 12:27:31
问题 I am working on a piece of code where I need to deal with uvs (2D texture coordinates) that are not necessarily in the 0 to 1 range. As an example, sometimes I will get a uv with a u component that is 1.2. In order to handle this I am implementing a wrapping which causes tiling by doing the following: u -= floor(u) v -= floor(v) Doing this causes 1.2 to become 0.2 which is the desired result. It also handles negative cases, such as -0.4 becoming 0.6. However, these calls to floor are rather

How to reduce the number of points in a curve while preserving its overall shape?

浪尽此生 提交于 2019-12-20 11:36:13
问题 I have a list of points that make a curve, and I would like to reduce the number of points, but still keep the overall shape of the curve. Basically, I want to go from this: To this: So the algorithm would remove the points that are redundant but preserve those that really define the shape (like the points at the bottom of the curve). Is there any known algorithm to do that? I expect there is but I'm not sure what to search for on Google. Any help would be appreciated. 回答1: Consider Douglas

How do I use Blender models in Java?

时光总嘲笑我的痴心妄想 提交于 2019-12-20 10:30:21
问题 Just a general question really? Let's say I am making a game and have made a character model in Blender. How would I use this model in Java? Would I import it somehow? Thanks. 回答1: Generally when making models in blender you export the model in a format which allows you to later import it in the game engine of your choice, which format you use differ in requirements. The export-import cycle is often referred to as the "Asset Pipeline", and you generally want to keep it as simple and automated

Water ripple effect on background of website

戏子无情 提交于 2019-12-20 10:27:19
问题 A client has asked me to apply a similar water ripple effect to the background image (and only the background image) on their website. Considering that this is using a canvas, it doesn't seem possible. Is anyone aware of an effect like this that I can apply to just the background image on a page? 回答1: For a high performance, WebGL powered solution, take a look at this project: jQuery WebGL Ripples A demo is available here. This technology is not available for everyone in every device yet,

Can I recognise (graphic tablet) Pen Pressure in Javascript?

自作多情 提交于 2019-12-20 10:25:34
问题 Is there any way to recognise pen pressure using javascript. Preferably I don't want to make any use of Flash and try get this done as pure JS. EDIT: okay I realised that it is kind of possible for Wacom tablets as they come with software that can work with their javascript api to make it possible (demos). But it's no good for people with Trust tablets or any other brand... So no good really. Any body know how to do it in C# if not JS? 回答1: Yes - if the user has a Wacom tablet installed, then

Minimum area quadrilateral algorithm

梦想的初衷 提交于 2019-12-20 10:24:25
问题 There are a few algorithms around for finding the minimal bounding rectangle containing a given (convex) polygon. Does anybody know about an algorithm for finding the minimal-area bounding quadrilateral (any quadrilateral, not just rectangles)? I've searched the internet for several hours now, but while I found a few theoretical papers on the matter, I did not find a single implementation... EDIT: People at Mathoverflow pointed me to an article with a mathematical solution (my post there),

How to draw on a Window in WPF (best practice)?

一曲冷凌霜 提交于 2019-12-20 09:49:05
问题 I am trying to write a small interactive game-like application, where I need to have a Draw method that's gonna draw on screen, but can't figure out how to structure the method for WPF. If this was Winforms , I could use: public void Draw (Graphics g) { } But for a WPF Window , what should I have on it in the xaml (currently only have a Grid ), and what should this Draw method receive as an argument? First I want to do it like this to get it working, then I can think about how to make it more

Simple Game in C# with only native libraries

我是研究僧i 提交于 2019-12-20 09:47:44
问题 I could find a set of java 2D game tutorials and android game tutorials which uses only native graphics libraries . I'm looking for something similar in C# ( without DirectX or XNA) I found this game loop skeleton , but it doesn't tell how to Render the Graphics. Target is to simulate a simple Electronic device. I need to show some graphical output as user "presses" some keys on the keyboard quickly.Hence it looks like an arcade game. For example As the user presses one of the arrow keys a

What's the best alternative to C++ for real-time graphics programming? [closed]

最后都变了- 提交于 2019-12-20 09:29:00
问题 As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance. Closed 7 years ago . C++ just sucks too much of my time by making me micro-manage my own memory, making me type far too much (hello std::vector<Thingy>: