|
|
I have a third party dll that is written in C++ that saves a bitmap image as the actual grayscale values and not a Bitmap format. I am looking for a way to read in the grayscale values and convert them to use C#/.NET 's Bitmap class.
Thanks
|
|
|
|
|
I'm guessing you mean something like :
file: 256, 0,0 ,12,25,89.. val_n.. etc...EOF (for a 16X16 image)
then the easiest way (C#) is to read the values into program then create a bitmap and read the values into pixels as:
Bitmap.SetPixel(X,Y, Color.FromRGB(val_n,val_n,val_n));
iterate and save bitmap done.
|
|
|
|
|
I have a problem when two images are overlapping in a area. Then I have to draw both the images side by side in such a way that they seems to be merging. I am drawing first image and then second image on same memory buffer. Now my problem is how to determine which pixel to draw (old Image/new Image). As to show merging I don't want to overwrite all the pixels of old image with new image. I have four color to play with.(ForeColor, BackColor, Old Memory Buffer Color, New Memory Buffer Color). All the images are color and using grayScale Alpha blending on edges so we will have lots of different color pixel in one image specially on edges. I hope some of graphics designer must have face this problem. Please let me know the approach or some algo to decide. Currently I am using one method to check the new memory color and old memory color distance from foreground color and printing the closer one. Also I did same with background color and printing which is far from background color. These are failing some time specially if I choose foreground and background color same.(Condition :-Main part of both Picture must be using foreground color as this is character text and that part should not be overwritten.).
Thanks in advance.
|
|
|
|
|
The general problem is called "image stitching" and a lot of software exists to handle stitching photographs into panoramic views. It sounds like your case is less general but the procedures probably are similar.
You measure democracy by the freedom it gives its dissidents, not the freedom it gives its assimilated conformists.
|
|
|
|
|
Thanks Tim.
This information helped me to find related stuff. But my problem is specially with same foreground and background color. You can think I have some text and each character is surrounded by clouds. Now I need to print these correctly rendered text in buffer so that surrounding cloud of text should be evenly overlapped but it should not overwrite the main text. My problem is mainly with same background and foreground color. Also my current code is very simple and I don't want to use any complex function(which is most of filters are doing) to get the correct pixel.
|
|
|
|
|
Ok, I think I understand your problem a bit better now. Is your text in any kind of regular pattern so that you can use OCR techniques to identify the margins and rows? If so, alignment of the text would be easy based on your layout rules. If there's something special about the background that also needs to be aligned somehow and it's fairly uniform, this sounds more like the problem of finding the back cat in the coal bin at midnight.
You measure democracy by the freedom it gives its dissidents, not the freedom it gives its assimilated conformists.
|
|
|
|
|
thanks tim. You are correct about the problem. But I dont have background color as a seprator because of cloud color. Without this clude I am using the fore and back color distance logic to get the correct color. But with this 3rd color problem is .
Up to no efficient solution for this in case anyone can help with more ideas.
|
|
|
|
|
Good day folks!
Does anyone know what might cause IDirectDrawSurface7::IsLost() to hang? In a multithreaded application time to time it happens that when IsLost() is called on a surface (primary surface if that matters) to check if it needs restoring it never returns, execution sits somewhere in ddraw.dll or nt.dll...i guess it deadlocks on something but what? DDSCL_MULTITHREADED is specified when SetCooperativeLevel is used but not having it doesn't seem to change anything. Also this happens on multiple computers with different accelerator hardware and drivers so it shouldn't be any driver problem. So does anyone know what could cause IsLost() to never return?
Thanks in advance for any answers.
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Sometimes you just have to hate coding to do it well. <
|
|
|
|
|
I got scanned forms (JPEG/PDF format) having check boxes in front of each question. I'm looking for a way to digitally read those images and determine whether box is checked or not. Is there any code/article that can help me achieve this goal?
Thanks in advance
|
|
|
|
|
Try this ot perhaps this
or search for IMAGE ANALYSIS.
However you are probably going to have issues unless the forms have a stable format, and are read into the jpeg or pdf in a somewhat reliable manner...
simply what you could do is find the xy locations of the boxes and test for darkness coverage say a value of 50 % darkened (or maybe 10 if you have handwritten data) and just pluck the marks out "manually"... --but this would only work in situations where the first check box is say in the Rectangle(75,125, 10,10) it would be trivial.
|
|
|
|
|
Dear all,
is there anybody who can suggest me a program (possibly free)or a way to convert a 32bpp image to RGB565 bmp format?
Thank you in advance
|
|
|
|
|
Sure, what I'd do is load the image into an HBITMAP and then get a pointer to the image's pixel data. Since you know it's a 32 bit image you know you need 4 bytes per pixel.
One of those is an alpha, and you can dump it. The other 3 are the rbg values.
I haven't compiled this, treat it as pseudo code - it outlines a mathod of iterating through an image and down-sampling it. I'm assuming its an 32 bit rgba image.
short procPixel(char r, char g, char b)
{
char tmp;
char lobyte, hibyte;
short result;
r >>= 3; // r = 000rrrrr
g >>= 2; // g = 00gggggg
b >>= 3; // b = 000bbbbb
// rrrrrggg gggbbbbb
tmp = g; // tmp = 00gggggg
tmp <<= 5; // tmp = ggg00000
lobyte = b; // lobyte = 000bbbbb
lobyte |= tmp; // lobyte = gggbbbbb
tmp = r; // tmp = 000rrrrr
tmp <<= 3; // tmp = rrrrr000
hibyte = tmp; // hibyte = rrrrr000
tmp = g; // tmp = 00gggggg
tmp >>= 3; // tmp = 00000ggg
hibyte |= tmp; // hibyte = rrrrrggg
result = hibyte;
result <<= 8;
result |= lobyte;
return nresult;
}
void myFunc(HBITMAP inputImage)
{
BITMAP bmInfo;
unsigned char *bitmapBits;
unsigned char *curPixel;
char r, g, b, a;
int width, height, x, y;
short r5g6b5;
GetObject(inputImage, sizeof(bmInfo), &bmInfo);
bitmapBits = (unsigned char*)bmInfo.bmBits;
curPixel = bitmapBits;
for (y=0; y<height; y++)
{
for (x=0; x<width; x++)
{
r = curPixel[0];
g = curPixel[1]; // I forget which one is which for r, g, b
b = curPixel[2];
a = curPixel[3]; // this one I'm sure about
r5g6b5 = procPixel(r, g, b);
doSomething(r5g6b5, x, y);
curPixel += 4;
}
}
}
|
|
|
|
|
Hi,
I want to display a static image as the background of the OpenGL window. It should be behind any object displayed in the scene. How to achieve this? Thanks in advance.
Ben
|
|
|
|
|
One way it to put your image on a big quad as a texture and position it perpendicular to the viewpoint. Depending on how you want it to appear as the camera moves, you'll have to recalculate it's position and orientation for each move. If you search for "billboarding" and OpenGL, you should find examples although it's often used for other background items.
You measure democracy by the freedom it gives its dissidents, not the freedom it gives its assimilated conformists.
|
|
|
|
|
Hi,i wanna get a Condition force feedback ,such as Friction ,Spring etc.,but i don'tknow why i can not feel it.I set the structure DICONTION and DIEFFECT as following :
DWORD dwAxes[1] = { DIJOFS_X } ;
LONG lDirection[1] = { 1 } ;
DICONDITION diCondtion;
DIEFFECT diEffect ;
diCondtion.dwNegativeSaturation=10000;
diCondtion.dwPositiveSaturation=10000;
diCondtion.lNegativeCoefficient=-10000;
diCondtion.lPositiveCoefficient=10000;
diCondtion.lOffset=0;
diCondtion.lDeadBand=2000;
diEffect.dwSize = sizeof(DIEFFECT) ;
diEffect.dwFlags = DIEFF_CARTESIAN | DIEFF_OBJECTOFFSETS ;
diEffect.dwDuration = DI_SECONDS/10 ;
diEffect.dwSamplePeriod = 0 ;
diEffect.dwGain = DI_FFNOMINALMAX ;
diEffect.dwTriggerButton = DIEB_NOTRIGGER ;
diEffect.dwTriggerRepeatInterval = 0 ;
diEffect.cAxes = 1 ;
diEffect.rgdwAxes = dwAxes ;
diEffect.rglDirection = lDirection ;
diEffect.lpEnvelope = NULL ;
diEffect.cbTypeSpecificParams = sizeof(diCondtion) ;
diEffect.lpvTypeSpecificParams = &diCondtion ;
hr = g_lpDIDeviceJoystick->CreateEffect(GUID_Spring,&diEffect,
&g_lpdi,NULL) ;
is any wrong with what i do ? If replace DICONDITION with DICONSTANTFORCE ,DIRAMPFORCE or DIPERIODIC ,accordingly i can get Constantforce ,RampForce ,PeriodicForce.but when it comes to DICONDITION
i can not get any force. who can tell me why ? any adivice is approciated ! oh ,i almost forget one thing !the joystick i used is MicroSoft sidewinder force feedback 2.
|
|
|
|
|
I have some fisheye (360 degree view) images and want to "dewarp" them back into rectilinear projections - I was hoping that someone may have some source code to share (C# preferred). I know that there are several programs out there that can do this, but I was hoping to understand the "how" through source code.
Thanks!
|
|
|
|
|
I've seen papers on the web that explain how it's done using various "cone" shaped mirrors but I don't recall any using a fisheye lens. There may or may not have been code attached to those articles, I just don't remember but if it was, it almost certainly wouldn't be in C#. The book "Learning OpenCV" by Gary Bradski has a chapter that explains how to use OpenCV and measure the intrinsic lens parameters and "correct" images based on them. This is just a case of correcting a very "bad" lens.
You measure democracy by the freedom it gives its dissidents, not the freedom it gives its assimilated conformists.
|
|
|
|
|
to the one who will read my request
I am a student in the third year in the university and i have to present a project about scientific calculation which mean that i have to present a graphical project about movvment of some objects which i choose ,but the proplem is i don't have any idea about opengl or directx to start with .
so i need help by suggesting a project title and if there is some ready project which i can use it to start i wil be very thankfull
and thank you again
|
|
|
|
|
People here aren't going to do your homework for you. If you have a very specific question once you get started, you may get an answer. But you have to show a bit of effort before anyone here will help you.
You measure democracy by the freedom it gives its dissidents, not the freedom it gives its assimilated conformists.
|
|
|
|
|
any way thank you
you gived me a briliante idea
we must always learn from children
for the second time thank you
|
|
|
|
|
Apparently you and learning, never the twain shall meet.
You measure democracy by the freedom it gives its dissidents, not the freedom it gives its assimilated conformists.
|
|
|
|
|
Hi Friends,
I made a desktop and audio(mike) capture GRF in graphedit.
On some systems audio recording stops after 30 sec but video recording has no issue.
I did all things in source code(c++ application) tracked IMediaEvent, but as audio recording stopeed in between no error event is fired.
Note: problem occur only on some laptop pc till now it has not occured in any desktop PC
Laptop "qasf.dll" version is 10.0.03802
I tried with differnt versions of same dll but all in vain on the laptop.
System configuartion is below:
RAM - 1790MB
CPU - Intel(R) Core (TM)2 duo CPU 1.83Ghz(2 CPU)
GRF file is stored at below link
http://www.fileflyer.com/view/uiqJXB1[^]
Thanks,
Subhash
|
|
|
|
|
how can load and transform (with annotations or equivalent ) an tiff file and save it again (with visual basic 2005 or C#)
|
|
|
|
|
xabalb wrote: how can load and transform (with annotations or equivalent ) an tiff file and save it again (with visual basic 2005 or C#)
This question is both too vague and too broad. Please explain what you have tried and where you are having problems, and maybe someone will be able to assist you.
|
|
|
|