|
Thanks for the quick reply, but like I said, I know next to nothing about programming in C#. I noticed that second function can't overwrite files, so I suppose I'd have to call another to delete any first... But a basic source would be extremely helpful for anyone who has the time
|
|
|
|
|
Have a look at this tutorial[^], all you need is 3 buttons and a PictureBox.
My failometer is detecting vast quantities of FAIL!
"Its SQL - hardly programming..." (Caslen)
|
|
|
|
|
I understand completely how to add buttons and generally how to use the picturebox, but I'm not at all familiar with calling functions and the basic structure of C#. I guess my main problem right now is figuring out how to make the picturebox cycle through all the pictures in a folder when a button is pressed...
|
|
|
|
|
Ok, I came up with the exact steps. It really shouldn't be that hard. It would be extremely helpful if someone would convert this to a source, but any help with specific parts would be helpful too.
Picture folder is working directory + /Textures/
PictureBox displays a picture from the Picture folder
The Down and Up buttons make the picturebox cycle forwards and backwards through the pictures
The export button returns the current picturebox picture, finds the .tex file with the same name, exports it to a specific directory on the SD card in a folder based on the first 2 digits in the name and renames the file to *00.tex
For an example, in the working directory there is a folder called Textures. The program looks in Textures for any .jpg file and opens it, we'll say it's 02cattexture.jpg. The user doesn't like it so he presses the down button and the program finds the next picture in the folder; it happens to be 01dogtexture.jpg. The user likes the texture and clicks export. The program then looks at the picture and finds the .tex extension equivalent in the same folder. Because the filename has 01 on the front, the program will copy (not move!) it to SD:/textures/dogtex/ and will rename it to dog00.tex. if the filename started with 02, it would copy it to SD:/textures/cattex/ and rename it cat00.tex. Oh, and if there's already a file with that name on the SD card, it overwrite it.
|
|
|
|
|
Not to be funny but it sounds to me like you have no clue of how to program. You have the basic idea of what you want to do but don't know how to write the code. Maybe a good Book for C# beginners??
Excellence is doing ordinary things extraordinarily well.
|
|
|
|
|
You almost got it I'm extremely well versed in gml, and I'm learning quite a bit about linux shell script and little python, but like I said, other than making hello world and a half functional calculator, I'm just about completely lost in C#. I can't stay focused on reading my C# book, and I learn by doing and seeing. Unfortunately, I do not see any examples that will help me, and I've tried so many times and have gotten so many errors during compiling, that I gave up trying. I figured you guys could probably write up my answer in five minutes or at least point me in the right direction, so I came here. Like I said, any help is greatly appreciated, but if no one can (or is willing) to help, then I'll be on my way.
|
|
|
|
|
After a simple Google search you will find this[^].
My failometer is detecting vast quantities of FAIL!
"Its SQL - hardly programming..." (Caslen)
|
|
|
|
|
Wow, I googled for quite a while and never saw this. Might I ask what exactly you googled? Anyhow, this will be a big help, thanks
|
|
|
|
|
'c# image slideshow application' and it was the second result.
My failometer is detecting vast quantities of FAIL!
"Its SQL - hardly programming..." (Caslen)
|
|
|
|
|
Ahh, didn't think of searching slideshow, but that actually works better
|
|
|
|
|
I think the "motto" of the site is show what you have done and where your problem is and the guys will help. There are a few sites with Video Tuts if that would help. Check this site. Development for Beginners[^]
Excellence is doing ordinary things extraordinarily well.
|
|
|
|
|
Hi people,
I want to have a print button in my GUI to print the contents of a panel (control drawn using Graphics class) perhaps to take a screenshot of the panel and print it out as an image.
Does anyone have any idea how I can do this?
Cheers
|
|
|
|
|
0) Don't cross post when your message is not imediatley reposponded to, your going to annoy people that way and they may not be too kind or they just may ignore it. It is considered rude. Have some patience.
1) Google[^]
My failometer is detecting vast quantities of FAIL!
"Its SQL - hardly programming..." (Caslen)
|
|
|
|
|
Sorry !! I didnt know it has been posted twice. the first time I posted it didnt appear on the forum board and gave me a message saying the website is installing some updates.
|
|
|
|
|
Apologies, I didn't know the site was down.
My failometer is detecting vast quantities of FAIL!
"Its SQL - hardly programming..." (Caslen)
|
|
|
|
|
I was working on some image filtering when I saw a problem in my output. After a little while I noticed two possible problems with the code after fixing one of them the output was, strangely enough, correct.
Here's a part of the code:
public struct Pixel
{
public byte r;
public byte g;
public byte b;
public static bool operator >(Pixel p1,Pixel p2)
{
return p1.r + p1.g + p1.b > p2.r + p2.g + p2.b;
}
}
Now my thought here was that since the r,g and b values are bytes, adding them could cause an overflow of the byte. For example: 128,128,128 would add up to 128 and would cause 64+64+64 to be greater then the second example since it adds up to 192 (192>128). However this does not seem to be the case, 128,128,128 seems to add up to 384 which would be impossible with a byte, so is the + operator actually changing my byte to a (u)long, (u)int or (u)short internally. Has anyone found any documentation on this issue, and can I expect this to work on any implementation of c#?
|
|
|
|
|
Hi,
expressions involving 8-bit or 16-bit integer variables (such as the bytes in a pixel) get computed using 32-bit integers, so there is an automatic promotion from byte to int, and the sum is an int. In your case, overflow is not possible.
BTW: this is not only true for C#, it holds true for all C-like languages such as C, C++, Java
Luc Pattyn [Forum Guidelines] [My Articles]
The quality and detail of your question reflects on the effectiveness of the help you are likely to get.
Show formatted code inside PRE tags, and give clear symptoms when describing a problem.
|
|
|
|
|
Thanks for your input!
I expected the byte to still behave as a true (8 bits) byte, does this also mean that ints work faster on a 32-bit machine then bytes do since a byte has to be processed to behave as a byte, example:
byte b = (byte)0x04 + (byte)0x10;
would be roughly translated to:
int b = 0xff &((byte)0x04+(byte)0x10);
And would a byte[12] take up the same amount of memory as an int[12] would, or would a byte array simply be a pointer to a field thats of the size int[3]
|
|
|
|
|
That is a lot of questions.
1. speed
Smaller variables typically don't get processed any faster or slower. Modern CPUs are capable of dealing with them very well. And storing the lowest byte or short of an integer is exactly the same as storing a byte or short, i.e. there are instructions that deal with the lower part of a register.
2. memory cost
For single variables, the size is not really important. It only becomes important when you have a lot of them, as in large arrays. In general an array takes a number of bytes equal to the number of elements times the size (in bytes) of a single element. So int[12] is four times larger than byte[12].
Conclusion: don't bother choosing byte/short/int until it becomes relevant, e.g. because:
- you want the overflow to occur (a value that should wrap from 255 to 0 can best be a byte)
- you want to preserve memory (as in images that may hold thousands or millions of pixels)
Luc Pattyn [Forum Guidelines] [My Articles]
The quality and detail of your question reflects on the effectiveness of the help you are likely to get.
Show formatted code inside PRE tags, and give clear symptoms when describing a problem.
|
|
|
|
|
Thanks a lot!
Since the size of the pictures I'm dealing with is fairly large (up to 5MP on current devices) and the ammount of memory and CPU power is generally low (PPC's are not that fast), I have had to really keep down on the CPU load and memory usage. I've found your comments to be very helpful.
|
|
|
|
|
you're welcome.
Luc Pattyn [Forum Guidelines] [My Articles]
The quality and detail of your question reflects on the effectiveness of the help you are likely to get.
Show formatted code inside PRE tags, and give clear symptoms when describing a problem.
|
|
|
|
|
i have an image of space from which i have to detect objects like stars,so i have to read each pixel's value in image and compare its each pixel's value with its neighbor pixels,if those pixels have same value then those pixels can be one star in space
|
|
|
|
|
It may not be as simple as that. A lot will depend on the quality of your images, and what was used to produce them, and a star will generally not be a simple area of pixels of the same value.
If you want to start writing astronomical image processing software, you should take a close look at a good selection of images from different sources and devices.
There are three kinds of people in the world - those who can count and those who can't...
|
|
|
|
|
molesworth wrote: It may not be as simple as that. A lot will depend on the quality of your images, and what was used to produce them, and a star will generally not be a simple area of pixels of the same value.
Unless the image is in single bit depth, or heavily processed it won't be.
Raw images in prosumer astronomy cameras are 12/16bit color depth, and since typical pixels are sized to have a capacity of between 40-100k electrons sampling noise is a factor in addition to the quantum noise of the chip itself.
Even ignoring noise, unless a star is perfectly centered on the corner between 4 pixels; and the pixels are large enough that all of the diffraction rings are completely on those 4 pixels; and the camera is anti-bloom* or the pixels aren't saturated; or the camera is non anti-bloom and you're only interested in IDing the middle of stars that have bloomed.
* normal daylight use cameras have a gap between each pixel on the sensor to keep them from blooming, this results in roughly 50% of the light falling on dead parts of the chip. For taking images of bright objects this doesn't matter (daylight, moon, planets), but doubles your exposure time for everything else. As a result most astrocams use chips that can bloom and require the user to combine multiple short exposures in post-processing. For most purposes this works better, the only exceptions being trying to image a very faint object next to a very bright one (eg the flame nebula (background for the horsehead)).
It is a truth universally acknowledged that a zombie in possession of brains must be in want of more brains.
-- Pride and Prejudice and Zombies
|
|
|
|
|
Search the articles for "Image processing for dummies". Christian Graus put together a nice set of articles on the subject.
|
|
|
|