w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
shift and rotation in matlab for handwritten digits
Let I be your image. %I = Input image; J = imrotate(I,30); %To rotate JS = [zeros(size(J,1),10), J]; %To shift 10pix horizontally figure,imshow(I) figure,imshow(J) figure,imshow(JS)

Categories : Matlab

OpenCV: Generating points from image after thinning
You should look into implementing your own connected components labelling. The concept is very simple: you scan the first line and assign unique labels to each horizontally connected strip of pixels. You basically check for every pixel if it is connected to its left neighbour and assign it either that neighbour's label or a new label. In the second row you do the same, but you also check against the pixels above it. Sometimes you need a label merge: two strips that were not connected in the previous row are joined in the current row. The way to deal with this is either to keep a list of label equivalences or use pointers to labels (so you can easily do a complete label change for an object). This is basically what findContours does, but if you implement it yourself you have the freedom to

Categories : Opencv

Handwritten mapper for List
If you really want to do this manually, then handy way is extension methods: public static T2 ToT2(this T1 t1) { return new T2 { ID = t1.ID, Name = t1.Name }; } public static List<T2> ToT2List(this IEnumerable<T1> t1List) { return t1List.Select(t1 => t1.ToT2()).ToList(); } Usage: T2 t2 = t1.ToT2(); List<T2> t2List = t1List.ToT2List(); But I suggest you to use Automapper (or other mapping tool), which will use reflection to match properties by name.

Categories : C#

Add text layer to PDF of scanned handwritten notes in OSX
I also scan my notes. Sometimes I go back and add some text to them using this technique: Open up the scanned pdf in Preview, then click on the "Edit" button in the top right corner, then the "Text tools" button on the left side (its a little box with Aa in it). From there you can drag open a text box and type into it. Now the secret trick is that if you save it here as it is and try to open it in your ipad using PDFExpert or some other program then the text might not be there. So here's how to go through that slight hiccup: After you've annotated your notes how you want instead of just saving it as a pdf, use the Print option: File->Print or Command+P. Now click the PDF button on the left to "Save it as a pdf". Now that its printed you can open it and search it in any program that reads

Categories : Osx

How to handle when some special UTF-8 characters are inside a XML file in matlab
The sample you posted works just fine. As the error message says, I think your actual files are incorrectly encoded. Remember that not all possible byte sequences are valid UTF-8 sequences: http://en.wikipedia.org/wiki/UTF-8#Invalid_byte_sequences A quick way to check is to open the file in Firefox. If the XML file has encoding problems, you'll see an error message like: XML Parsing Error: not well-formed EDIT: So I took a look at the file: Your problem is that XML parsers treat files without the <?xml ... ?> declaration line as UTF-8, but your file looks to be encoded as ISO-8859-1 (Latin 1) or Windows-1252 (CP-1252) instead. For instance, the SAX parser choked on the following token: Baños. This character "n letter with tilde", which is U+00F1, has different representa

Categories : Xml

How to find aspect ratio of all the characters in a binary word using MATLAB?
Use bwlabel and regionprops to get the 'BoundingBox' property for each connected component. Then you can get the aspect ratio by dividing the width and the height of the bounding-box (last 2 entries of the 4-vector describing each bounding box). Best of luck...

Categories : Matlab

Javascript: Determine if all characters in a string are unique and if not, delete duplicate characters
Don't do it that way. function noDups( s ) { var chars = {}, rv = ''; for (var i = 0; i < s.length; ++i) { if (!(s[i] in chars)) { chars[s[i]] = 1; rv += s[i]; } } return rv; } alert(noDups("Shoe fly pie, and apple pan dowdy")); // Shoe flypi,andw As the length of your string gets longer, your code gets slower by a factor roughly equal to the square of the length of the string.

Categories : Javascript

Divide text string into sections (separate divs) of 500 characters (or any other # of characters) using PHP?
PHP offers a function for that, it is called 'str_split()'. You can use it like this: <?php $content = get_the_content(); $chunks = str_split($content, 500); //Printing each chunk in a div foreach($chunks as $chunk_content) { echo "<div>"; echo $chunk_content; echo "</div>"; } ?> More info to str_split: http://www.php.net/manual/en/function.str-split.php EDIT: If words should not get cut in the middle, use this function instead: <?php $content = get_the_content(); $strings = wordwrap($content, 500, "{BREAK}"); //Put a {BREAK} every 500 characters $chunks = explode("{BREAK}", $strings); //Put each segment separated by {BREAK} into an array field //Printing each chunk in a div foreach($chunks as $chunk_content) { echo "<div>"; echo $chunk

Categories : PHP

Trying to find a regex match for lowercase characters, but ignore first 11 characters
try ^.{11}[^a-z]*[a-z]+ conceptually, this pattern skips 11 characters at the beginning of a line, matches an arbitrary number of non-lowercase characters finally matching at least 1 lowercase char. complement the first chracter class with characters you do not want to occur in matching line.

Categories : Regex

How to replace several characters on a single string to desired characters (java)?
public class TranslateChar { /** @param args */ public static void main(final String[] args) { final Map<Character, Character> mapCharCod = new HashMap<>(36); final Map<Character, Character> mapCharDecod = new HashMap<>(36); mapCharCod.put('A', 'Z'); mapCharCod.put('B', 'X'); mapCharCod.put('C', 'Y'); mapCharDecod.put('Z', 'A'); mapCharDecod.put('X', 'B'); mapCharDecod.put('Y', 'C'); final String toCod = "CAB"; StringBuilder sb = new StringBuilder("{"); for (final char c : toCod.toCharArray()) { sb.append(mapCharCod.get(c)); sb.append(','); } sb.setCharAt(sb.length() - 1, '}'); System.out.println(sb.toString()); f

Categories : Java

Where can I a mapping of Identity-H encoded characters to ASCII or Unicode characters?
It is not always possible to extract text from a PDF especially when the /ToUnicode map is missing as pointed out by mkl. If it is not possible to cut and paste the correct text from Acrobat then you will have very little chance of extracting the text yourself. If Acrobat cannot extract it then it is very unlikely that any other tool can extract the text correctly. If you manually create an encoding table then you could use this to remap the extracted characters to their correct values but this most likely will only work for this one document. Often this is done on purpose. I have seen documents that randomly remap characters differently for each font in the dot. It is used as a form of obfuscation and the only real way to extract text from these PDF's is to resort to OCR. Ther

Categories : Pdf

Textbox input control (number of characters, type of characters)
I would recommend that you use a RegularExpressionValidator. They are very easy to markup: <asp:RegularExpressionValidator ControlToValidate="NameOfTextBox" <!-- the input text box name --> ValidationExpression="[a-zA-Z]{4}[UJZ]d{9}" ErrorMessage="Please enter a valid container number." Display="Dynamic" <!-- this means it's display: none when no error --> EnabledClientScript="true" <!-- this will perform JavaScript validation --> runat="server" /> Now, with the EnabledClientScript="true" it will actually validate the control with JavaScript, if it's enabled, but because you still can't rely on that you need to validate server-side too. So, what you'll do is in the button click, where you want validation to occur, the first block of cod

Categories : C#

Replace non UTF compliant characters characters in a meaningful way rather than simply removing them
The javadoc for StringBufferInputStream says Deprecated. This class does not properly convert characters into bytes. As of JDK 1.1, the preferred way to create a stream from a string is via the StringReader class. Don't use it. The file is read as bytes, no matter where it comes from. Never convert your data to a String if you need it as bytes in the first place. If you're reading from a file, use a FileInputStream. (Never use FileReader, since it doesn't allow you to specify the encoding.)

Categories : Java

Highlight individual characters and then refreshing the screen to ONLY those characters
If you just want to refresh the screen: $( "span.letter:not(.highlight)" ).fadeOut(); If you really want need to reload the page, you could put the visible letters in the hash of your url. The hash is the part after # and you retrieve it with window.location.hash. For an URL like http://yoururl.com/letters/highlight#abc it would yield #abc. The refresh would then effectively be a redirect to your same URL with a different hash parameter.

Categories : Javascript

Regular Expression allow a decimal with up to 3 characters or integer with up to 2 characters
Use the following regexp: ^(d{1,2}.?|d.d)$ The first alternative allows 2-digit integer with an optional decimal point, the second allows a digit followed by 1 decimal place. If it passes this validation, then test it against: [^0] to ensure it's not zero.

Categories : Regex

Do not allow special characters except the allowed characters javascript regex
You don't need to separate your individual characters by commas, nor do you need to wrap the only term in brackets. This should work: /[`^~<>,"']/ note the carat (^ is not at the front, this has a special meaning when placed at the start of the [] block) Also you should use test() because you only want a boolean if-contains result /[`^~<>,"']/.test(password)

Categories : Javascript

Converting Special Characters From Database to Normal Characters
As I've worked a lot with "non-english" characters, several things are required for proper display and storage of those characters. In no particular order (as I don't know what charset is best suited for Persian, I'll use UTF-8, if it's different, you just use the one you need): Tell your browser what charset you are using, either by setting the proper header from PHP header('Content-type: text/html; charset=utf-8'); or set the meta tag in your html like so: <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> In the database avoid mixing different collations and charsets in the columns/tables. I always set the database, the tables and the columns to utf8_general_ci which for my needs work all the time (languages like English, German, Serbian, Hungarian...). As J

Categories : PHP

xs:simpleType restricted to a xs:string of a length of either n characters or m characters
What about something like following? <xs:simpleType name="string_10_13"> <xs:restriction base="xs:string"> <xs:pattern value=".{10}|.{13}" /> </xs:restriction> </xs:simpleType> It should be more precise (e.g. to eliminate white spaces etc.) but it could be a way. Without regex following could work: <xs:simpleType name="string_10"> <xs:restriction base="xs:string"> <xs:length value="10" /> </xs:restriction> </xs:simpleType> <xs:simpleType name="string_13"> <xs:restriction base="xs:string"> <xs:length value="13" /> </xs:restriction> </xs:simpleType> <xs:simpleType name="string_10_13"> <xs:union memberTypes="string_10 string_13"/> </

Categories : Xml

Converting foreign characters in english characters in Java
One solutions is to change the encoding of your Ide, for example if you uses Eclipse you go where you run the project (run configurations) and put in the vm the following sentence -Dfile.encoding=cp1252 with for example you allow accents and spanish characters.

Categories : Java

How can I use set list to highlight otherwise invisible characters, except when those characters are tabs?
I don't think you can do that. The help for 'listchars' states The "NonText" highlighting will be used for "eol", "extends" and "precedes". "SpecialKey" for "nbsp", "tab" and "trail". That is to say tab and trail get the SpecialKey highlighting eol gets the NonText highlighting space gets the Normal highlighting You are free to link these highlighting groups any way you like with :hi, but as far as I know you cannot change the highlighting groups they belong to. See :h :hi-link. :set listchars+=tab: :hi! link SpecialKey Normal

Categories : Vim

Matlab: Improper index matrix reference (or outsmarting matlab)
In the latest versions of MATLAB (13a/13b) there's a unit testing framework built in that looks very similar to what you're attempting. Instead of expect(myfibonacci(0)).toBe(0); you would write import matlab.unittest.constraints.IsEqualTo testCase.verifyThat(myfibonacci(0), IsEqualTo(0)) (You could also/instead have assumeThat, assertThat, or fatalAssertThat). If for some reason you wish to implement your own framework, note the small difference in your syntaxes - you have a dot whereas MathWorks have a comma between myfibonacci(0) and the test condition. In MATLAB you can't index into the result of a subscripted expression like that (well, you could, but you would have to overload subsref, and that's a world of pain, trust me). So the way they've done it is to introduce the test

Categories : Matlab

Launching Matlab from java ProcessBuilder, Matlab console doesn't appear in Mac OS 10.8
You need to specify that MATLAB is to run with a visible UI by making use of the -desktop flag. I don't believe this is documented. So the command you need to run is matlab -desktop -r "initMatlab;runJavaUI;" I've created a Java library called matlabcontrol that can abstract all of this away from you. It can launch MATLAB while running on Windows, OS X, and Linux and then allow you to interact with MATLAB via eval and feval commands. matlabcontrol's code to launch MATLAB is located in matlabcontrol.RemoteMatlabProxyFactory's createProcess(...) method. If you make use of matlabcontrol as a Java library you won't directly interact with either this class or this method.

Categories : Java

How to apply a trained Matlab neural network from C++ without call to Matlab?
Of course it is possible - neural networks are clear mathematical models. All you need is a compatible representation, where you have stored: network topology (number of neurons in particuluar layers) network weights (between all neurons) network activation functions (for each neuron) And that's all. The exact solution depends on what matlab library you are using for neural networks. There is a "standard" for prediction models called PMML, which can be loaded by for example Weka libraries. Either way - it is easy operation, so you can also implement it by hand by simply storing all the numbers in the text file and simulating network in the C++ (as the "forward" phase of the neural network is just few lines of code - the training part is the long one).

Categories : C++

Will Matlab standalone be faster than Matlab from UI for long execution code?
Applications built with MATLAB Compiler should execute at pretty much exactly the same speed as within MATLAB. MATLAB Compiler does not convert your MATLAB code into machine code in the same way as a C compiler does for C. What it does is to archive and encrypt your MATLAB code (note, it properly encrypts it, not just pcodes it as a comment suggests), create a thin executable wrapper and package them together, possibly also with MATLAB Compiler Runtime (MCR). MCR is very similar to MATLAB itself, without a graphical user interface, and is freely redistibutable. When you run the executable, it dearchives and decrypts your MATLAB code and runs it against the MCR. It should run exactly the same, both in terms of results and speed. Very old versions of MATLAB Compiler (pre-version 4.0) work

Categories : Matlab

how to convert x1 x2 x3 ... characters to normal characters without erasing in c++
They are characters with the ordinal values 1, 2, and 3. They are called control characters and are not printable, which is why the debugger is showing you their escaped representation. You can look the control characters up in an ASCII table.

Categories : C++

MATLAB - What are the units of Matlab Camera Calibration Toolbox
I know next to nothing about matlabs (not entirely true but i avoid matlab wherever I can, and that would be almost always possible) tracking utilities but here's some general info. Pixel dimension on the sensor has nothing to do with the size of the pixel on screen, or in model space. For all purposes a camera produces a picture that has no meaningful units. A tracking process is unaware of the scale of the scene. (the perspective projection takes care of that). You can re insert a scale by taking 2 tracked points and measuring the distance between those points. This is the solver spaces distance is pretty much arbitrary. Now if you know the real distance between these points you can get a conversion factor. By doing: real distance / solver space distance. There's really now way to kno

Categories : Matlab

Run Matlab executable file with MATLAB Compiler Runtime (MCR)
It simply means that you don't have rights to run PROGRAM. What is the output of the command: ls -l PROGRAM ? Maybe you've compiled this program as a root? Try to change the access using chmod.

Categories : Matlab

MatLab-->csv: Export data to csv file using dlmwrite in Matlab
I think the problem is that you write the names to a file at the local folder and not the other folder. fldr = fullfile('c:','Data_Analysis'); nomFile=fullfile( fldr, 'Test.csv' ); fid=fopen(nomFile,'w'); fprintf(fid,'%s,',names{:}); fprintf(fid,' '); dlmwrite(nomFile,A,'-append'); fclose(fid);

Categories : Matlab

MATLAB: checkmark in MATLAB figure with LaTeX interpreter
it's not pretty, but might be good enough: xlabel('$surd$','interpreter','latex') or look here for other things that look like a tick http://detexify.kirelabs.org

Categories : Matlab

How to get the Matlab workspace associated with the current Matlab project in C#?
I have already the solution, the way is the next: Create a .m file (for example SaveWorskpace.m) con this information: save test.mat Add SaveWorskpace.m at the project with Matlab Compiler Deployment Tool. Compile the project with Matlab Compiler Deployment Tool Add reference at the c# project Call function SaveWorkspace() Ready, you have variables save in the workspace test.mat

Categories : C#

Call matlab from c++ using VS2010 and matlab 2007a
This is probably very late reply but this sample code of mine may help you. #include<iostream> #include<math.h> #include<engine.h> #pragma comment (lib, "libmat.lib") #pragma comment (lib, "libmx.lib") #pragma comment (lib, "libmex.lib") #pragma comment (lib, "libeng.lib") using namespace std; const int N = 9; //Number of grid points int main() { // start matlab engine Engine *ep = engOpen(NULL); if (!(ep = engOpen(""))) { fprintf(stderr, " Can't start MATLAB engine "); return EXIT_FAILURE; } int i, j; // Grid creation with aspect ratio r double sum_r = 0, r = 1; for (i = 0; i < N-1; i++){ sum_r += pow(r,i); } double dx0 = 1 / sum_r; // calculate first dx double dy0 =

Categories : C++

Matlab density plot, Heat map, Matlab
You can control the colour of each point like so: scatter(x1, y1, [], C) where C is the same size as your x1 and y1 matrices. Now if you describe the rules of how you want this heatmap colour modulation to happen, we can help you construct C from x1 and y1...

Categories : Matlab

Count all characters, then print how many of which characters
Use collections.Counter: >>> from collections import Counter >>> Counter('hello world!') Counter({'l': 3, 'o': 2, '!': 1, ' ': 1, 'e': 1, 'd': 1, 'h': 1, 'r': 1, 'w': 1}) Didn't notice that you want to preserve the order. For that you can use OrderedCounter example from collections module documentation: >>> from collections import OrderedDict >>> >>> class OrderedCounter(Counter, OrderedDict): ... def __repr__(self): ... return '%s(%r)' % (self.__class__.__name__, OrderedDict(self)) ... def __reduce__(self): ... return self.__class__, (OrderedDict(self),) ... >>> >>> count = OrderedCounter('hello world!') >>> count OrderedCounter(OrderedDict([('h', 1), ('e', 1), ('l', 3), ('o', 2), (' ',

Categories : Python

compile a matlab gui for win 32 system using 64 bit win and MATLAB
As far as I know you cannot actually use 64 bit matlab to build a 32 bit program. When I faced the same situation, Mathworks recommended me to (also) install 32 bit matlab on my 64 bit windows. I did not try it, but that should allow you to build 32 bit programs again.

Categories : Matlab

How to use Matlab from JAVA without using the Matlab Compiler
If you have Matlab (but you don't have builderJA) then you can use matlabcontrol for using matlab functions in java.(There might be other alternatives too, but I don't know) If you don't have Matlab at all then you can "create the java version of the matlab function" in some other computer having Matlab and builderJA installed, and use the jar files in your own computer. You only need to have MCR (Matlab Compiler Runtime- Its FREE) installed on your computer. Strickly answering your question: Is there a way to do use Matlab from JAVA, but without the need to have the Matlab Compiler? The answer is: Yes, you can use it. Using matlabcontrol (A java API to interact with Matlab).

Categories : Java

MATLAB Compiler vs MATLAB Coder
I'm not an expert, but the Coder is described as generating standalone C/C++ code, making no mention of the MCR. I notice however that it says that it only supports a "subset" of the Matlab language, which you can read more about here. The Compiler appears to just package up your Matlab code as you suggested, so probably supports most features.

Categories : Matlab

Converting MATLAB 'imagesc' function to work with R's 'imagesc' from R's 'matlab' library
As I read the question and the linked material and some other material found with Google, you want the combined capacities of the image and axis functions in R. Some of the other material said that imagesc really only relabels the axis annotation. (And it has some additional color scaling capacity that you don't seem to be requesting.) Reading images in from files may take some extra packages. There is a grImport package with useful capabilities for pdf. There are also packages that specialize in particular formats, eg. tiff or rtiff. If you have a modes sized matrix to plot, you should offer dput(mat). In the absence of an example and specific directions can offer this adaptation of an example in the middle of the Examples section of ?image. > image(t(volcano)[ncol(volcano):1,]) #

Categories : R

Image download with arabic characters in filename (Arabic characters)
Use the following web encoding tool and encode the Arabic URL and then hardcode to the url in the program and try http://meyerweb.com/eric/tools/dencoder/

Categories : Android

How can I add a period after the first three characters and then a ' every 3 characters after?
You were on the right track with number_format but you have to specify all 4 parameters to achieve the result you are looking for. You also need to divide the number by 1000 to avoid the extra decimal places. echo number_format($number / 1000, 3, "." , "'"); See: http://php.net/manual/en/function.number-format.php PHPFiddle: http://phpfiddle.org/main/code/e2c-a6q

Categories : PHP

Look for several characters in a string and get back an array of characters that are in the string?
You could loop. It seems a bit clunky to me though. $s = "ABCDEFGEHIJ"; $a = array("2", "7", "A", "E", "J", "W", "Z"); $matches = array(); foreach ($a as $i) { if (strpos($i, $s)) { $matches[] = $i; } } Alternately regexp replace for everything not in the array of characters: $s = "ABCDEFGEHIJ"; $a = array("2", "7", "A", "E", "J", "W", "Z"); $out = preg_replace('/[^' . implode('',$a) . ']/' , '', $s); And turn that into an array with str_split($out)

Categories : PHP



© Copyright 2017 w3hello.com Publishing Limited. All rights reserved.