|
Quick and dirty : you could do an pixel average between the 2 images.
|
|
|
|
|
using VC++, how to cut a rectangle segment picture from an bmp format image?
and the cutting rectangle can has diffrent angle. my mean is that the cutted image is certainly rectangle, and the cutting segment is also rectangle, but the tow rectangles are not parallel, there is a rotated angle between them.
thanks
|
|
|
|
|
Wouldn't this be more suited to the C++ forum since you're asking a C++ specific question.
|
|
|
|
|
There are two things I think you could be wanting to do here. I assume you don't want to draw a rotated black rectangle over the image, but want to get a rotated bit of the image
This is quite drawn out to explain if you don't have much experience with graphics already...
What you want to do is take the rectangle you want to cut and work out coordinates for the pixels, translate and rotate them (rotation matrix - google) and interpolate (bilinear interpolation - google it) between the neighbouring pixels in the original image to find the new pixel values.
I would give a full explanation, but if you are a graphics programmer you should already be familiar with these ideas.
Hope this helps.
|
|
|
|
|
thank you Jheriko++:
maybe i didn't describe my question clearly. assume i have a big image which is rectange, i want to cut a segment image from the big image, the segment image is also rectance, but the borders of the segment rectange are not parallel with the big image borders.
but from your explain, i think you first cut a rectange image from the big image, and then rotaed it.
wish you understand my opinion.
|
|
|
|
|
Hi all, I'm facing problem with the C++ code which i've included below!! I need to output the RGB values of each pixel(preferably in array form), but I'm not sure how to use the getPixel here to output values of each point in terms of R, G and B separately. Is there any other better functions to use or do ya have any idea how i could manipulate this function to my program??
The block i tried below on GetRValue(&image), GetGValue(&image) and GetBValue gives me a hexadecimal value for the first 2 but i cannot seem to compile when i tried to do the same -->GetBValue(&image).
Thank You~~
Regards,
Stressed One
#include <windows.h>
#include <iostream.h>
#include <cimg.h>
#include <stdio.h>
using namespace cimg_library;
HANDLE hfile;
DWORD written;
BITMAPFILEHEADER bfh;
BITMAPINFOHEADER bih;
RGBTRIPLE *image;
int main() {
int size, x,y, crColor;
float R,G,B;
double hf;
// Open the file
hfile = CreateFile("bear.bmp",GENERIC_READ,FILE_SHARE_READ,NULL,OPEN_EXISTING,NULL,NULL);
// Read the header
ReadFile(hfile,&bfh,sizeof(bfh),&written,NULL);
ReadFile(hfile,&bih,sizeof(bih),&written,NULL);
// Read image
size = bih.biWidth*bih.biHeight; //allocate memory for the image
ReadFile(hfile,NULL,size*sizeof(RGBTRIPLE),&written,NULL); // Reads it off the disk
cout<<"The image width is "<<bih.biwidth<<"\n"; output="" the="" width="" of="" bitmap
="" cout<<"the="" image="" height="" is="" "<<bih.biheight<<"\n";=""
="" load="" image
="" cimg<unsigned="" char=""> image("bear.bmp");
CImgDisplay main_disp(image);
while (!main_disp.is_closed) {
main_disp.wait();
int getPixel(int x, int y);
R = GetRValue(image);
G = GetGValue(image);
B = GetBValue(image);
printf("%02X %02X %02X\r", GetRValue(image), GetGValue(image), GetBValue(image));
}
return 0;
}
|
|
|
|
|
Check the prototype of GetRValue, GetGValue and GetBValue, they return a BYTE from a DWORD rgb color.
other than that, I have not looked further at your code.
|
|
|
|
|
There's a bunch of problems with this code.
The code that reads the BMP makes alot of assumptions about the
BMP file format so it's going to fail in many instances.
Then the file is reloaded as a CImg object. Why?
There's no code anywhere that actually gets a pixel value from the bitmap.
...
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
OK, lets get the laughing out our systems now. I can't load a cube (I'm new to XNA, but know a little C#). I'm following an article on CodeProject but it won't load the model ( iahve it a different name, but I made it so it SHOULD work) But, C# keeps saying it can't find the model in the folders.
protected override void LoadGraphicsContent(bool loadAllContent)<br />
{<br />
if (loadAllContent)<br />
{<br />
Player_Model = content.Load<Model>("Content\\Models\\Cube");<br />
}<br />
}<br /> I clearly stated them in the solution explorer... Help? Thanks in advance.
The most knowledge doesn't mean the most wise...
|
|
|
|
|
Didn't you forget the file extension ?
|
|
|
|
|
I'm Showing Videos on a WinForm and the Bounds of the Video are
videoWidth = form.Width
videoHeight = form.Width * videoHeight / videoWidth
videoX = 0
videoY = (form.Height - videoHeight) / 2
So the Video will Always be placed in the Center of the Form and Stretched to the Width of the Form and Height/YLoc Adjusted Accordingly. The Form's Backcolor is Black.
Depending upon the Video's Width to Height Ratio the Video's YLoc will be >=0. Now I can Need to Show the Messages onto the Form at the same Location (say 20, 20) Irrespective of the Video's YLoc. To show Messages I can
1) ONLY Paint Text on the Form at Fixed Loc. Problem - If the Video's YLoc = 0, then my Text would not be shown
2) ONLY Write Text Directly onto the Video. Text's Location will always depend on the Video's YLoc.
So what I see is that I need to use a combination of the above two methods.
So What can you suggest?
Thanks...
|
|
|
|
|
good evening,
i am not familiar with graphics field,but i tried to attach .swf image
to my website in the entry page but i couldnt,also i want to ask how can i download swf files and if there is any software important to access the file
thanks in advance
dina
|
|
|
|
|
hi dina
to Upload u r .swf file to u r web site pls put the code
<object codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.h.cab#3,0,0,0" height="200" width="740" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000">
<param name="SRC" value="<b>flash folder name/File name</b>.swf" />
<embed src="<b>flash folder name / file name</b>.swf" pluginspage="http://www.macromedia.com/shockwave/download/" type="application/x-shockwave-flash" width="740" height="200" />
|
put this code where ever u need for flash.swf animations
Vgopi Krishna
|
|
|
|
|
hi... i have programmed VC++ with OpenGL application..the application was with three window, each one with owen lighting effects,motion, and objects i.e every window with its related myint() , firstly the programm was working succesfully but after some days i wanted to execute my program again the result was : the windows related to the lighting effects displayed nothing..nothing was in the windows(pitch black)..no object..no light..no motion!!!!..i would like to ask about the reason that makes two of three windows faild to dispaly objects and lighting effects althought the application was succesfuly programmed and no errors or wrongs were appeared. what can i do?
regards
Maria
|
|
|
|
|
It may be stupid but check that the camera is positioned correctly and that some objects are effectively in the view frustrum.
|
|
|
|
|
Hi, i'm trying to draw EMF or WMF files in an antialiased way.
I tried GDI+, AA drawing is ok when using DrawLine or other primitives but the DrawImage doesnt produce
AA output when beeing passed a Metafile object containing a WMF or EMF
So is there a way to draw EMF/WMF files with antialias ? (with or without gdi+)
Maybe something exists in order to convert EMF/WMF to EMF+ ? (it seems gdi+ can only AA on EMF+ files)
thanks for your help
|
|
|
|
|
|
Hi, i'm not sure if i've chosen correct place for my post, but
I'm writing an app in VC++ 2005 EE which is going to display some 3D figures on System::Windows::Forms::Panel^ panel
The problem:
I've written my own class which handles all OpenGL stuff. So all I have to do is:
Create new 3D figure object, and draw it with panel's Paint method.
Constructor needs panel's HWND, so i did something like this:
<br />
TFigure *Figure;
Figure = new TCuboid( (HWND)panel->Handle.ToPointer() , panel->Width, panel->Height, 3, 3, 7 );<br />
But this solution doesn't work properly. When i'm trying to initialize OpenGl machine
with this code (inside TCuboid construcor):
<br />
m_gHDC = GetDC( hwnd );
SetupPixelFormat();<br />
m_hRC = wglCreateContext( m_gHDC );
the variable: m_hRC is NULL and it shouldn't be.
GetLastError() returns 2000, which is ERROR_INVALID_PIXEL_FORMAT.
I've tried my class code with other IDE and all was fine.
This is SetupPixelFormat() definition:
<br />
void TFigure::SetupPixelFormat()<br />
{<br />
int nPixelFormat = 0;<br />
PIXELFORMATDESCRIPTOR pfd = {<br />
sizeof(PIXELFORMATDESCRIPTOR),<br />
1,<br />
PFD_DRAW_TO_WINDOW |<br />
PFD_SUPPORT_OPENGL |<br />
PFD_DOUBLEBUFFER,<br />
PFD_TYPE_RGBA,<br />
32,<br />
0, 0, 0, 0, 0, 0,<br />
0,<br />
0,<br />
0,<br />
0,0,0,0,<br />
16,<br />
0,<br />
0,<br />
PFD_MAIN_PLANE,<br />
0,<br />
0, 0, 0 };<br />
<br />
nPixelFormat = ChoosePixelFormat( m_gHDC, &pfd );<br />
SetPixelFormat( m_gHDC, nPixelFormat, &pfd );<br />
}<br />
ChoosePixelFormat( m_gHDC, &pfd ); returns 7
Can somebody help me please?
|
|
|
|
|
Hi all,
Please I need help in printing an OpenGL scene in C#
I'm not a graphic developer, so I don't have any experience in OpenGL, I just have very little information about OpenGL
I've searched the web but results often in VC++, I need C# code to print from OpenGL
also I need help in exporting to bitmap files and WMF files if possible
Thanks alot
|
|
|
|
|
hi friends,
I am developing a web application in that I need incorporate a audio recording control , imge capturing from a web cam and scanner, which enables the user to record audio file, and capture images either from web-cam or from a scanner. is there any activex control providing such features ?
If so, please help me in this regard..
thank u all,
kiran
|
|
|
|
|
hi
if you want suchtype of functionality mail me on my mail id
trioum@yahoo.com
Trioum
|
|
|
|
|
I cannot solve the following problem. I created a scence with directional light (according to OpenGL docs, illuminaton of an object for this sort of light doesnt depend on how far a directional light is from the object). Further, I put a simple primitive (e.g. sphere) into my scence. Now I can run the program and enjoy the resulting picture. However, a problem occures if I try to scale the object (using glScale() function). I am observing a strange effect: setting large scale my object becames darker ("underlightning") and, vise versa, setting scale small my object becames very bright ("overlightning"). My question is how to overcome this effect (i.e. setting different scales I should get same illumination picture).
|
|
|
|
|
|
Hi,
Actually I need to control the Audio of a sound card(Decklink).Is there anyway to control the audio of the decklink card using directshow? For your information I have a sound renderer for the decklink card through which I can able to render the sound and also I had tried to use the IBaseAudio interface through which I can able to control only the system volume not the card volume. Can anyone help me to solve this?
Thanks in advance,
With regards
Raja Bose
Raja Bose
|
|
|
|
|
I found a way to write my game in c#, but it using 3d graphics. XP and voodoo3 don't agree with each other. So i need to know how to change this so i can use software or change it to full screen when it opens:
namespace WindowsGame1
{
class Engine : Microsoft.Xna.Framework.Game
{
Microsoft.Xna.Framework.GraphicsDeviceManager Graphics;
Microsoft.Xna.Framework.Content.ContentManager Content;
Microsoft.Xna.Framework.Graphics.Texture2D mytext;
Microsoft.Xna.Framework.Graphics.SpriteBatch SpriteBatch;
Microsoft.Xna.Framework.Vector2 Spritepos;
public Engine()
{
this.Graphics = new Microsoft.Xna.Framework.GraphicsDeviceManager(this);
this.Content = new Microsoft.Xna.Framework.Content.ContentManager(this.Services);
}
protected override void Initialize()
{
this.Spritepos = new Microsoft.Xna.Framework.Vector2(100f, 50f);
base.Initialize();
}
protected override void LoadGraphicsContent(bool loadAllContent)
{
if (loadAllContent)
{
this.mytext = this.Content.Load<microsoft.xna.framework.graphics.texture2d>(@"new\text\Mike1");
this.SpriteBatch = new Microsoft.Xna.Framework.Graphics.SpriteBatch(this.Graphics.GraphicsDevice);
}
}
protected override void UnloadGraphicsContent(bool unloadAllContent)
{
if (unloadAllContent)
{
this.Content.Unload();
}
}
protected override void Update(Microsoft.Xna.Framework.GameTime gameTime)
{
base.Update(gameTime);
}
protected override void Draw(Microsoft.Xna.Framework.GameTime gameTime)
{
this.Graphics.GraphicsDevice.Clear(Microsoft.Xna.Framework.Graphics.Color.Black);
this.SpriteBatch.Begin(Microsoft.Xna.Framework.Graphics.SpriteBlendMode.AlphaBlend);
this.SpriteBatch.Draw(this.mytext, this.Spritepos, Microsoft.Xna.Framework.Graphics.Color.White);
this.SpriteBatch.End();
base.Draw(gameTime);
}
}
}
Michael
(Up and coming Game programmer)
EST
|
|
|
|
|