OpenCV for iOS sudoku grabber - objective-c

I'm following this tutorial
http://aishack.in/tutorials/sudoku-grabber-with-opencv-detection/
But it's not fot the iOS.
some methods described there can be used, but the floodfill (used as cvFloodFill) is no longer an int. it's a void
I'm trying to get the size of the biggest blob, It's pretty much the part i'm missing. this for loops and the floodfill.
is there a good way of doing it?
I thought about the cvBlob library, but I just can't get it to compile for mac.. tried many ways....
EDIT: After arkiaz's answer, moved to a new question:
openCV cvContourArea
Thanks!

Instead of floodfill you can use findcontour to find biggest blob.
Do as follows:
1) Apply adaptive threshold, some erosion and dilation etc ( as mentioned in aishack)
2) Find contours using findcontours
3) Use contourarea to find area of each contour
5) Select the one with max. area. That will be the sudoku box. Then continue as given in aishack.in
For me, this method worked faster than floodfill method

Related

Reverse a decryption algorithm with a given .exe GUI

I am using a Keygen application (.exe). There are two input fields in it's GUI:
p1 - at least 1 digit, 10 digits max - ^[0-9]{1,10}$
p2 - 12 chars max - uppercase letters/digits/underscores - ^[A-Z0-9_]{0,12}$
Pressing generate button produce a key x.
x - 20 digits exactly - ^[0-9]{20}$
For each pair (p1,p2), there is only one x (in other words: f(p1,p2) = x is a function)
I am interested in it's encryption algorithm.
Is there any way of reverse engineering the algorithm?
I thought of two ways:
decompiling. I used snowman, but the output is too polluted. The decompiled code probably contains non-relevant parts, such as the GUI.
analyzing of input and output. I wonder if there any option to determine the used encryption algorithm by analyzing a set of f(p1,p2) = x results.
As you mentioned, using snowman or some other decompiling tools is probably the way to go.
I doubt you would be able to determine the algorithm just by looking at the input output combinations, since it is possible to write any kind of arbitrary algorithm, that can behave in any way.
Perhaps you could just ask the author what algorithm they're using ?
Unless it's something really simple, I'd rule out your option 2 of trying to figure it out by looking at input and output pairs.
For decompiling / reverse engineering a static binary, you should first determine whether it's a .NET application or something else. If it's written in .NET you can try this for decompilation:
https://www.jetbrains.com/decompiler/
It's really easy to use, unless the binary has been obfuscated.
If the application is not a .NET application, you can try Ghidra and/or Cutter which both has pretty impressive decompilers built in:
https://ghidra-sre.org/
https://cutter.re/
If static code analysis is not enough, you can add a debugger to it. Ghidra and x64dbg work really well together, and can be synced via a plugin installed in both.
If you're new to this, I can recommend both that you look into basic assembler for the x86 platform so you have a general idea of how the CPU works. Another way to get started is "crackme" style challenges from CTF competitions. Often there great write-ups with the solution, so you have both the question and answer available.
Good luck!
Type in p1 and p2. Scan the process for that byte string. Then put a hardware breakpoint for memory access on it. Generate the key, it will hit that hardware breakpoint. Then you have the address which accesses it and start reversing from there in Ghidra(Don't forget to use BASE + OFFSET) since ghidra's output won't have the same base as the running application. The relevant code HAS to access the inputs. So you know where the algorithm is. Since it either directly accesses it, or somewhere within that call chain is accessed relatively fast. Nobody can know without actually seeing the executable.

Is there a way of using the <prosody> tag in SSML to adjust individual words without a pause (without using a post-processor)

When using the prosody tag in SSML with Google Cloud TTS, I cannot adjust the attributes of individual words without creating an unwanted pause.
The code below creates a lag between 'New' and 'Video'. It has been suggested that a postprocessor can remove these pauses, but I'd like to know if there's a way of doing it directly within the code itself?
<speak>
Hello, and welcome to this<prosody pitch="+3st">New</prosody>Video Tutorial.
</speak>
After testing, it appears there isn't a way of doing this using Google Cloud TTS. You can manually edit the sound file after generating it, but thay defeats the object of the exercise.
I don't have the cleanest answer, as what you are asking is not very supported. Prosody's pitch contour let's you change the tone of voice at different parts of the sentence.
Example of Prosody contour
<speak><prosody contour="(0%, +20Hz) (20%, +30%) (100%, +20%)"> Hello friends! </prosody></speak>
I am still playing around with this, but it seems like a tedious way of getting what you want done.
Using contour
contour takes a string of tuples "(%position in sentence, pitch adjustment) (..., ...)
I hope this helped and best of luck on your work!

How to load textures after startup in XNA using vb.net

I've encountered a problem with my gameproject lately. When I load more than a certain number of textures (around 1000) at startup I recieve an error regarding memory (because I have to use 32-bit in XNA). I am self-taught and so have only basic knowledge of the "correct" ways to program a game. The project itself is getting very big and although I try to compress images together etc, I will have to use more than 1000 textures throughout the project.
My question, then, is: How can I load textures at other points in time than at startup in XNA, using vb.net? (I'm not using classes at all that I'm aware of, so I hope to stay away from that if possible)
Thank's for any feedback on this!
/Christian
I cannot comment, so I'll just put my idea here. Declaration time: I am also self-taught developer, so the algorithm that I'm using isn't proven to be the standard or anything like that. Hope it helps!
I am using a single class called GContent witch is "instanciated" (more like loaded) the first thing when game starts. This class is static, and it has lists for all textures, sounds and spritefonts in game. So, anywhere in my code I can put GContent.Texture("texture_folder\\texture_name"); (similar for sound and spritefont). Now, before this function loads Texture2D, it checks it's list of textures, and tries to return a texture with the name that is asked for in parameter. If it finds the right texture, it returns the texture from the list. If not, it uses Content.Load(textureFullPath); (by full path I don't mean "C:\Users\....") to load the texture, give it a name (Texture2D.Name) equal to the parameter textureFullPath, adds that texture to the list, and then returns the new texture. So, the more you play my game, the more textures will be loaded, if I don't load all the assets at the start of the game. Now, I imagine you can simply have an array of strings that represent all textures that are used by a single level, or a map, or main menu... This way, you could easaly create function that will take List< string > and try to load or unload all textures of one map/level/menu...
So, my answer is pretty much: have a static class with lists of assets and load/unload asset(s) from where ever in game you want!
Also, if my answer helped you, please, check it as an answer :)
So the answer seems a lot easier than I expected, if I'm doing it right at the moment(?).
I simply Load the content needed for all "Worlds" in the beginning of the game (in the Protected Overrides Sub LoadContent()) and then Dispose() and Load.Content() depending on what World is loaded later (in any Sub I choose):
TextureName = Content.Load(Of Texture2D)("")
TextureName.Dispose()
If there isn't any problem I'm not yet aware of, this seem to do the trick and does not leave me with the memory error in the start.
Thank you Davor Mlinaric and Monset for helping me along

webrtc AEC algorithm

I have made a software that uses WebRTC DSP libraries (AEC, NS, AGC, VAD). Now I need to know what algorithm uses each one to write my MasterĀ“s Thesis, but I don't find any information about that.
Someone knows the algorithms of this libraries, specially the Acoustic Echo Cancellation (like for example NLMS, that I know it's commonly used, but I don't know if WebRTC also uses it).
I've tryed to know the algorithm looking into the source code, but I don't understand enough.
Thanks in advance!
I've just successfully using standalone WebRTC aecm module for android. and there's some tips:
1.the most important is the thing called "delay", you can find the definition of it in dir:
..\src\modules\audio_processing\include\audio_processing.h
quote:
Sets the |delay| in ms between AnalyzeReverseStream() receiving a
far-end frame and ProcessStream() receiving a near-end frame
containing the corresponding echo. On the client-side this can be
expressed as delay = (t_render - t_analyze) + (t_process - t_capture)
where,
t_analyze is the time a frame is passed to AnalyzeReverseStream() and t_render is the time the first sample of the same frame is
rendered by the audio hardware.
t_capture is the time the first sample of a frame is captured by the audio hardware and t_pull is the time the same frame is passed to
ProcessStream().
if you wanna use aecm module in standalone mode, be sure you obey this doc strictly.
2.AudioRecord and AudioTrack sometimes block(due to minimized buffer size), so when you calc the delay, don't forget adding blocking time to it.
3.if you don't know how to compile aecm module, you may learn Android NDK first, and the module src path is
..\src\modules\audio_processing\aecm
BTW, this blog may help a lot in native dev. and debuging.
http://mhandroid.wordpress.com/2011/01/23/using-eclipse-for-android-cc-development/
http://mhandroid.wordpress.com/2011/01/23/using-eclipse-for-android-cc-debugging/
hope this may help you.
From the code inspection of AGC algorithm in WebRtc, it matches closely with the description in http://www.ti.com/lit/wp/spraal1/spraal1.pdf
It's based on NLMS, but has a variable step length (mu).

Color profiles conversion

I have a project on color profile conversion in C++, where the idea is to use CIELAB as transition between RGB and all others (CMY; CMYK; HSV; HSL;...).But I have one big big problem. I have searched everywhere and I cannot find any formula or descrition how could I convert CIELAB to others(CMY; CMYK; HSV; HSL; ...) only I got is what I found here : http://www.easyrgb.com/index.php?X=MATH&H=14#text14 . Can someone please help me with formula or with an idea how to get to them? Thank you so so much.
Regards,
magic :)
Color conversion with mathematical formulas yields very poor results with no serious application. Color systems are far too complex to capture them in simple, closed mathematical formulas let alone in linear formulas.
Good results can only be achived by using color profile files. And the conversion basically invovles interpolation between samples stored in these files.
Have a look at Little CMS. It probably does everything you need. Or if your software will run on Windows, you can use the built-in Windows Color System to do the conversion.