Jump to content

schoel

Active Members
  • Posts

    27
  • Joined

  • Last visited

schoel's Achievements

Seeker

Seeker (1/7)

1

Reputation

  1. I passed 542, 343, 732, 354. All well within the resolution of both computers. I run Windows Vista on both. Same service packs, same version of Vista.
  2. I moved the following script from one computer to another and the execution time increased from less than a second to more than two minutes. Does anyone have an idea why? The other computer is not a lot slower for other tasks. The script looks at each pixel in a box, starting from the upper left and then continues row by row. For each pixel, it checks the color of the pixel and then calculates a value for the pixels brightness, and after that, if the brightness is above 130 it writes 255 255 255 (white) to a file or if it is less than 130, it writes 0 0 0 (black) to the same file. When I tried this, a box 190 * 100 pixels took less than a second on one computer and more than two minutes on the other. Two minutes is painfully slow and I can't see why this happens. It's only 19000 loops, which should go quickly on a 1.8GHz dual core processor. Func Pixels($x1, $y1, $x2, $y2) DirCreate("Temp") Local $writeString = "" $nrOfCols = $x2 - $x1 + 1 $nrOfRows = $y2 - $y1 + 1 $tempFile = FileOpen("Temp\temp.pnm", 2) FileWriteLine($tempFile, "P3") FileWriteLine($tempFile, $nrOfCols & " " & $nrOfRows) FileWriteLine($tempFile, "255") For $y = $y1 To $y2 For $x = $x1 To $x2 $color = PixelGetColor($x, $y) $red = BitShift(BitAND($color, 16711680), 16) $green = BitShift(BitAND($color, 65280), 8) $blue = BitAND($color, 255) $brightness = (0.3 * $red) + (0.59 * $green) + (0.11 * $blue) If $brightness > 130 Then $writeString &= " 255 255 255" Else $writeString &= " 0 0 0" EndIf Next FileWriteLine($tempFile, $writeString) $writeString = "" Next EndFunc
  3. Hello, Disregard my last post. Found on previous page solution to this. GUISetState(@SW_SHOWNOACTIVATE) works well!
  4. If you get a value between 0 and 731, just divide the returned number by 731 and you have the percentage. E.g. 731 / 731 = 1 = 100%, 0 / 731 = 0 = 0%
  5. Hello! I really like your script. I've been using it to display subtitles for movies. However, whenever I create a new text, the movie goes out of fullscreen. I would therefore like to update the text rather than create a new one. I looked at the function _FreeText_Shape_SetText. Is this function for updating texts? I tried it and nothing happens. The text stays as it is. How can update my texts? Best regards, Schoel
  6. Thank you!
  7. Hello, I would like to display a text on the screen (as subtitles to a movie). Is it possible somehow to do this without creating a GUI? Best regards, Schoel
  8. Hello eltorro, I really like your script. It saved me a lot of time writing a config reader/writer myself! I do, however, have a question about it. When I use it (i.e. run a script from the SciTE Editor with F5) I get a lot of "3"s on the stdout, that is the place where runtime errors normally are printed. Do you have any idea why I get these? The script works as intended though, I'm just curious. Best regards, Schoel
  9. Yeah I was thinking about a static tolerance. I guess I will have to use a function though.
  10. Yeah, I'm aware that it is possible in C++. I know that they are just functions but the code would be a lot more readable if I could make it an operator. I will have lots and lots of comparisons and an operator would just make it a lot nicer.
  11. The include looks right to me. Are you sure you spelled everything correctly? Filename, variable name etc.
  12. Is it possible to define your own operators? For example, if I would like to define ~= for checking if two numbers are almost equal.
  13. That's exactly what the first script does. It collects the RGB value of each pixel in the area determined by the coordinates. I was hoping that the OCR is smart enough to do mentioned preprocessing on its own. I believe that comment is mostly meant for linux systems (it was originally coded for linux) but I'm sure there is a port of djpeg for windows as well. However, making your own conversion of any format to pnm is not very hard, since the pnm format is very easy.
  14. Thanks! That's why I made it in the first place
×
×
  • Create New...