|
First you have to figure out what format the picture was taken in. If it's RAW or BMP, then you've got nice little bytes of information for each rgb value of each pixel. If it was JPEG, then you've got to decompress it to get the pixel values.
I think it might help to search for the term "threshold" in regards to picture analysis. It is basically getting rid of the colors that you don't want.
Another way to find areas of the same color, since your data is basically a matrix, is to treat the column number as "x", treat the RGB value as "y", then find the change in y as x increases, along the row (aka a derivative). Then you've got an array of 0's for filled in areas of the same color, and enormous values at the border zones, and you can fill in your shape w/ whatever geometry you want to get the area.
Or, if this is a long term project, you could check out Activision Tools or Euresys E-Vision. They already do this all this and much more.
|
|
|
|
|
Here are my requirements:
1) A PDF viewer that is embedded in a window in my windows app.
2) I must be able to reference button_click events in the PDF from my windows app. (i.e. if i click a button in the PDF, the event occurs in my windows app.
Pertaining to the above requirements:
Here is what I've noticed so far. The Adobe Reader ActiveX works great at simply viewing PDF's and the buttons are shown too. However, I haven't found anything in the Reader library that allows me to reference the buttons in the PDF. This leaves the following questions.
Possible Solutions: (need your help/recommendations)
1) Can I use the Acrobat SDK to reference the document that is open inside my Adobe Reader ActiveX control? (If I can, then i can get a hold of my buttons and events). If I can do this, does anyone have any clue about the proper syntax? All of the the samples I've seen actually reference a document that acrobat opens, not the reader....
2) Can I embed the Adobe Acrobat (not the reader) in my windows app in order to view the files? I haven't seen this done yet. Every example I've seen opens the acrobat in it's own window!!!
3) Is there other software out there that offers both functionalities: 1) Embedded viewing window with 2) Full access to PDF library?
Any help in this matter would be greatly appreciated, as I have searched High, Low, and In Between for a solution.
Thanks,
jpc
|
|
|
|
|
Hi again,
I wonder if there is any possibility to accomplish the following:
A GUI has a button with attached eventhadler (button_click).
In this eventhandler, there shall be called a function, that gathers some information. The information iInfo shall be returned like
int iInfo = gatherSomeInfo();
to the eventhandler button_click in the GUI.
Here is the Problem: The gatherSomeInfo() function needs eventhandling to collect all information. So I have to leave the gatherSomeInfo() function before knowing what to return and loosing the ability to send the needed information back (as return value). It is not possible to collect all information and immediatly return from this gatherSomeInfo() function back to the eventhandler in the GUI.
The gatherSomeInfo() Function is hooked into another event (of another thread in fact) that finally signals the info. From that moment on I could send a return value but I don't know how.
The function call of gatherSomeInfo() within the button_click eventhandler would block the further execution (if waiting for return value) until the return is done but that would exactly be what I need for this procedure.
How can I do this??? I can't believe that there is no way to do that. Can anyone help please???
|
|
|
|
|
What you need is an asynchronous event. Have a look at my article here[^] or google with that search term.
DaveBTW, in software, hope and pray is not a viable strategy. (Luc Pattyn) Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia) Why are you using VB6? Do you hate yourself? (Christian Graus)
|
|
|
|
|
Hi all
I have an xml document created from a treeview. I want to delete a node from xml (and treeview at the same of course)
Here is my codes:
treeView1.Nodes.Remove(treeView1.SelectedNode);
XmlNode t=dom.SelectSingleNode(treeView1.SelectedNode.Text);
t.ParentNode.RemoveChild(t);
dom.Save("test.Xml"); //this is where program fails it gives the message "invalid xml document"
Can anyone help?
|
|
|
|
|
Your treeview text is an xpath to the node ? I doubt that, and suspect that you're erasing the entire document. Did you look in the debugger to see what t is, what gets returned and what the dom XML is when you save ?
Christian Graus
Driven to the arms of OSX by Vista.
"I am new to programming world. I have been learning c# for about past four weeks. I am quite acquainted with the fundamentals of c#. Now I have to work on a project which converts given flat files to XML using the XML serialization method" - SK64 ( but the forums have stuff like this posted every day )
|
|
|
|
|
Hi, is there a way to list the contents of constants?
ie. is there a function ConstantCollection() (see below) or something similar?
class Test()
{
const string c1="blah1";
const string c2="blah2";
const string c3="blah3";
const string c4="blah4";
void Print()
{
foreach(object Constant in <code>ConstantCollection(this)</code>)Debug.Print(Constant.Contents);
}
}
Output:
blah1
blah2
blah3
blah4
Ariadne
|
|
|
|
|
Not that I know of, although if the constants are all of the same type then you could use an enum instead.
DaveBTW, in software, hope and pray is not a viable strategy. (Luc Pattyn) Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia) Why are you using VB6? Do you hate yourself? (Christian Graus)
|
|
|
|
|
That won't work in this case - enum values cannot be strings.
|
|
|
|
|
But it is possible to attach strings to enums using the Description attribute.
"WPF has many lovers. It's a veritable porn star!" - Josh Smith As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
My blog | My articles | MoXAML PowerToys | Onyx
|
|
|
|
|
I am an idiot! Provided the consts are single words, you can use them in an enum and use the names as const strings.
enum sample
{
Hello = 0,
There,
Last
}
static void Main(string[] args)
{
for (sample t = 0; t < sample.Last; t++)
{
Console.WriteLine(t);
}
Console.WriteLine("---");
}
I think I'd rather define a class to hold my const strings and use a method to iterrate, though.
|
|
|
|
|
Using reflection:
List<string> list = new List<string>();
FieldInfo[] fis = type.GetFields(BindingFlags.Public | BindingFlags.Static | BindingFlags.FlattenHierarchy);
foreach (FieldInfo fi in fis)
{
if (fi.IsLiteral && !fi.IsInitOnly)
list.Add(fi.Name);
}
return list;
"WPF has many lovers. It's a veritable porn star!" - Josh Smith As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
My blog | My articles | MoXAML PowerToys | Onyx
|
|
|
|
|
Thanks Pete,
that's what I'm looking for. It works fine.
Ariadne
|
|
|
|
|
HI,
I'm not sure if exist something like ConstantCollection, but this works for me (VB.net):
Firts a simple class:
Public Class Class1
Public Const c1 As String = "c1"
Public Const c2 As String = "c2"
Const c3 As String = "c3"
Dim var1 As String
Public var2 As String
Public Enum myEnum
value1
value2
End Enum
End Class
For Each field As FieldInfo In getConstants(GetType(Class1))
Console.WriteLine(field.Name)
Next
Private Function getConstants(ByVal pType As System.Type) As List(Of System.Reflection.FieldInfo)
Dim fis() As FieldInfo
Dim result As New List(Of System.Reflection.FieldInfo)
fis = pType.GetFields()
For Each fi As FieldInfo In fis
If fi.IsLiteral And Not fi.IsInitOnly Then
result.Add(fi)
End If
Next
Return result
End Function
This returns:
c1
c2
The constants must be declared public.
RolCr.
|
|
|
|
|
Hi,
I'm accessing files from remote PC (basically in from different domain) in Windows Service. During debug (when i put break point and debug through line by line) it goes well, but in deployment mode it throws following error
"Bad user name or password"
How to fix this?
Thanks
|
|
|
|
|
Hi,
Verifie the "Log on" Tab for the service, which account are you using?
|
|
|
|
|
Hi
im trying to implement a calendar interface in my C# application but im not sure what the best way to draw the calendar is - i had a look at the form controls in visual C# 2005 and thought the datagridview might be a good start then populate it with events from an Xml file
Another possible solution would be google calender but i couldnt find any help with drawing google calender in C# application and thier tutorial was about adding and manipultaing events using .NET cliet libraries.
Does anyone have any ideas for this? i would appreciate any help
Cheers
|
|
|
|
|
The DateTimePicker control does it all for you presuming your working with WinForms and not WebForms.
Regards,
Rob Philpott.
|
|
|
|
|
Thanks for the reply, Rob. this is not what i im looking for though. i want to draw a calendar for a schedule and to have the days of the week displayed vertically and the time horizontally (similar to school timetable format) and then to populate this with shifts created in the program.
|
|
|
|
|
Personally I would handle the paint event for a panel and draw with the Graphics class, that way I can make it look anyway I want it to
Life goes very fast. Tomorrow, today is already yesterday.
|
|
|
|
|
A bit like Outlooks Calendar feature? Sorry, got the wrong end of the stick. Two routes to what you want - either get a 3rd party control which does that sort of thing or roll your own.
If you've not written a control like that before, its not a light undertaking!
Regards,
Rob Philpott.
|
|
|
|
|
what do you mean by third party control? something like Google calendar API
Cheers
|
|
|
|
|
You might want to have a look at:
Month Calendar[^]
and maybe:
Calendar DayView Control[^]
as well. There are demos and source code you can download and tweak should you wish.
Hope this helps, and good luck.
|
|
|
|
|
hi guys
i am having trouble formating my string text for my listbox.
this is what i am using
String.Format("{0,-15} \t {1,-50} \t {2,-20} \t", data1,data2,data3);
however due to the amount of space some text used up when many words are used the tab always goes out of place and end up making untidy
does anyone have a better alternative or a solution for this problem? pls assist
|
|
|
|
|
Try a fixed-size font (e.g. Courier) and fill it up with spaces instead of tabs
Doesn't look to cool, I know. If you want something better looking, try the DataGridView or the ListView .
I are troll
|
|
|
|