w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
Using TextWatcher to get values entered to two edittext and multiplying these values without a button. Automatic computation.
You should set the default values of the edittext to 0. Its probably force closing because you are trying to parse an empty string from an edittext that has nothing in it; EDIT: try this if (height != null) heightInt = Double.parseDouble(!height.getText().toString().equals("")? height.getText().toString() : "0"); if (weight != null) weightInt = Double.parseDouble(!weight.getText().toString().equals("")? weight.getText().toString() : "0"); this way your using a condition where no matter what youll be parsing a value that wont throw an exception

Categories : Java

Find Region On Image - Automatic Rotate Image OpenCv
I don't know openCV, but you added the C# and C++ tags, which make me suppose that you would accept an algorithm that can be implemented in these languages. To answer your first question: If your images are all similar to the ones you provided, you could do something like this (these are not necessarily sequential steps, they are numbered just for ease of reference): convert to black & white (you could do this only conceptually, if you prefer, by comparing pixel values to a threshold, in what follows) travel along the black outline in vertical, horizontal and diagonal single-pixel steps remember N pairs of coordinates while you travel, so that N is below the expected minimum length, in pixels, of a straight line of your images (you will have to tune N: too long gives you too little

Categories : C#

Automatic values for updated_at, created_at in Doctrine
Yes you can for createdAt you can add $this>setCreatedAt(new DateTime()); into __construct method, for both you can use Life Cycle Callbacks : /** * * @ORMPrePersist * @ORMPreUpdate */ public function updatedTimestamps() { $this->setUpdatedAt(new DateTime('now')); if ($this->getCreatedAt() == null) { $this->setCreatedAt(new DateTime('now')); } } And don't forget to add into entity class notation: * @ORMHasLifecycleCallbacks

Categories : PHP

Is it possible to start Fancybox on page load with a youtube video automatic and close at end automatic?
Yes, it's possible. Take the example at the fancybox website (tips & tricks No.15), and tweak it to your needs. First, you would need to load the youtube player API (apart from the jQuery and fancybox js and css files of course) <script src="http://www.youtube.com/player_api"></script> Then built the onYouTubePlayerAPIReady() function with the fancybox custom script inside of it to launch the video. Then, inside the fancybox beforeShow callback, set a listener for the end of the video and close fancybox using the method $.fancybox.close() like : function onYouTubePlayerAPIReady() { $(document).ready(function () { $.fancybox({ href: "http://www.youtube.com/embed/L9szn1QQfas?enablejsapi=1&wmode=opaque&autoplay=1", type: "ifra

Categories : Jquery

Automatic split of character matrix according to a column values into variable number of new dataframes
By the sounds of it, you're looking for the split function. x <- structure(c("Hi", "Med", "Hi", "Low", "A", "D", "A", "C", "8", "3", "9", "9", "1", "1", "1", "2"), .Dim = c(4L, 4L), .Dimnames = list(NULL, c("b", "x", "y", "z"))) split(data.frame(x), x[, 2]) # $A # b x y z # 1 Hi A 8 1 # 3 Hi A 9 1 # # $C # b x y z # 4 Low C 9 2 # # $D # b x y z # 2 Med D 3 1 The resulting data.frames are all in a single list, but you can do things with assign if you want to actually split them into individual data.frames in your workspace.

Categories : R

python fast fourier coefficients filtering and thresholding deciding
You don't even need a lambda for your first question, rather you can use list comprehensions. >>> print [n if n > 5 else 0 for n in [100, 2, 50, 4, 15, 7]] This question on stats might provide some insight on determining a threshold.

Categories : Python

Get RGB color values on OpenCV and C#
First of all, you'll probably want to have: imgOriginal.Data[mouse_get_Y, mouse_get_X, 0]; //note X and Y swapped Secondly, in OpenCV data is stored in bands which you choose with the last index. Their interpretation depends on your image type. If you have BGR image type for example, then: imgOriginal.Data[mouse_get_Y, mouse_get_X, 0]; // blue imgOriginal.Data[mouse_get_Y, mouse_get_X, 1]; // green imgOriginal.Data[mouse_get_Y, mouse_get_X, 2]; // red Similarly to other image types defined in this namespace: http://www.emgu.com/wiki/files/1.3.0.0/html/b72c032d-59ae-c36f-5e00-12f8d621dfb8.htm When bands have byte resolution they have values from range 0...255, so basically you have an integer already, and you can put it into a text box easily: textBox.Text = byteValue.ToString();

Categories : C#

Histogram of an array of values in OpenCv
You can use calcHist with a Mat of size 1xN, where N is 630 in your case. I don't understand your argument against counters. To build the histogram, you must use counters anyway. There are ways to make counting very efficient. OR Assuming your image is a cv::Mat variable im with size 1x630 and type CV_8UC1, try: std::vector<int> counts(36, 0); for (int c = 0; c < 630; c++) counts.at(im.at<unsigned char>(1, c)) += 1; std::cout << "Most frequently occuring value: " << std::max_element(counts); This uses counting, but will not take more than 0.1ms on an average PC.

Categories : Opencv

Different Pixel Values in MATLAB and C++ with OpenCV
You are converting the image if certain conditions are met, this can change some color values while MATLAB can choose to not convert the image but use the raw image colors are mostly represented in hex format with popular implementations in the format of 0xAARRGGBB or 0xRRGGBBAA, so 32 bit integers will do (unsigned/signed doesn't matter, the hex value is still the same), create a 64 bit variable, add all the 32 bit variables together and then divide by the amount of pixels, this will get you a quite accurate result (for images up to 16384 by 16384 pixels (where a 32 bit value is representing the color of one pixel), if larger, then a 64 bit integer will not be enough). long long total = 0; long long divisor = image.width * image.height; for(int x = 0; x < image.width; ++x) { for(

Categories : C++

OpenCV - gaussianKernel with filter2D and double values
You access matrix with wrong coordinate order. First coordinate must be row index and second - column index: for(int i = 0; i < cos_angles.rows; i++){ for(int j = 0; j < cos_angles.cols; j++){ cos_angles.at<double>(i, j) = std::cos(2 * angles.at<double>(i, j)); sin_angles.at<double>(i, j) = std::sin(2 * angles.at<double>(i, j)); } }

Categories : C++

Using get() and put() to access pixel values in OpenCV for Java
It was happening because of byte() casting. I changed the data type of mat image in second case to *CV_64FC3* so that I can use double[] instead of byte[] and it solved the problem. Mat A = Highgui.imread(image_addr); //"image_addr" is the address of the image Mat C = A.clone(); A.convertTo(A, CvType.CV_64FC3); // New line added. int size = (int) (A.total() * A.channels()); double[] temp = new double[size]; // use double[] instead of byte[] A.get(0, 0, temp); for (int i = 0; i < size; i++) temp[i] = (temp[i] / 2); // no more casting required. C.put(0, 0, temp); FYI, I also did some time measurement and using second method is way faster than first method.

Categories : Java

how to scale the pixel values ​​in the range [0,1] in opencv
See: Convert uchar Mat to float Mat in OpenCV? After this, you can simply divide by 255 to get the range from 0 to 1

Categories : C++

getting garbage values while accessing elements in mat in openCV
First, stick with either the C API (CvMat*, cvFoo) or C++ API(Mat, Foo). With that cleared, you do get a correct rotation matrix, now you have to apply it using either cvWarpAffine or WarpAffine.

Categories : C++

How to choose appropriate Scalar values when using InRange in OpenCV
There is probably no way to automatically determine a threshold that works for all kind of videos. But to make it less dependent on the overall lightning of the video you could make it depend on the mean or median pixel value of the image. Or if you know how big your object appears in the image, you could choose the threshold accordingly. Another approach could be to normalize the brightness of the video. But which approach is best strongly dependents on your exact situation and requirements.

Categories : Opencv

Compute absolute values of X and Y derivatives using OpenCV
If you simply need the absolute value of the gradient, without any normalization, you can use cv::convertScaleAbs(). This will find the absolute value and convert to 8-bit unsigned type in one go. cv::Mat dx, dy; cv::Sobel(img, dx, CV_16S, 1, 0); cv::Sobel(img, dy, CV_16S, 0, 1); cv::convertScaleAbs(dx, dx); cv::convertScaleAbs(dy, dy); Note that this method only calculates the absolute value of the derivative, and does not normalize the results to [0, 255]. If you need a normalized result, then your posted code seems to be the best way to do it. As far as your method seeming "wasteful", make sure that making multiple data passes is a demonstrated performance bottleneck before worrying about "waste". Unfortunately, OpenCV doesn't have much support for reducing the number of data passe

Categories : C++

Are there any possible values for the 6th parameter to OpenCV's CvMat* cvInitMatHeader
You should always check the OpenCV's official documentation first. CvMat* cvInitMatHeader(CvMat* mat, int rows, int cols, int type, void* data=NULL, int step=CV_AUTOSTEP) You would find out, that step is "full row width in bytes of the assigned data. By default, the minimal possible step is used which assumes there are no gaps between subsequent rows of the matrix."

Categories : C

OpenCV template matching max min value wrong values returned
this looks pretty suspicious: Mat result = new Mat(result_rows, result_cols, CvType.CV_8U); // better use CvType.CV_32F here Imgproc.matchTemplate(largeImage, smallImage, result, templateMatchMethod); Core.normalize(result, result, 0, 1, Core.NORM_MINMAX, -1, new Mat()); // normalizing a uchar mat into [0..1] can only result in garbage. again, it will work much nicer, if you use float type for result and skip the normalize

Categories : Opencv

print values of CV_8UC4 matrix type in OpenCV
Access your CV_8UC4 matrix properly: image.at<cv::Vec4b>(j,i)[0]; image.at<cv::Vec4b>(j,i)[1]; image.at<cv::Vec4b>(j,i)[2]; image.at<cv::Vec4b>(j,i)[3];

Categories : C

imread in pylab vs opencv: returning completely different array values
They don't match for a couple reasons: matplotlib reads the color values as RGB whereas OpenCV uses BGR The rows in matplotlib's array appear to list pixel rows from the bottom of the image to the top (don't ask me why), whereas OpenCV goes from top to bottom Perhaps there is a nicer way of doing this, but if you wanted to match them, you would find: pylab_img[::-1,:,::-1] == cv_img

Categories : Python

Android + OpenCV: OnTouch getX(), getY() doesn't return right values
This is the solution to your problem. which is, @Override public boolean onTouch(View arg0,MotionEvent event) { double cols = mRgba.cols();// mRgba is your image frame double rows = mRgba.rows(); double xOffset = (mOpenCvCameraView.getWidth() - cols) / 2; double yOffset = (mOpenCvCameraView.getHeight() - rows) / 2; onClickX = (float)(event).getX() - xOffset; onClickY = (float)(event).getY() - yOffset;

Categories : Android

OpenCV Error: Assertion failed (ptnum > 3) in unknown function, file (Java + opencv 2.4.6)
I think the problem lies in the number of points in your convex hull. It should have at least 3 points to make using the convexityDefect() possible. It can easily be checked using an if in the for loop: if(hull_.rows() >= 3){ Imgproc.convexityDefects(contours.get(0), hull_, convexityDefects); }

Categories : Java

opencv libraries precompiled for javacv opencv android project
It will take a little more effort to "run this code" correctly. In short, JavaCV is a wrapper on top of OpenCV, and you have to compile the OpenCV and correctly move all the shared libraries (.so) to your Android development project etc. Like the original article suggested, you need to go to JavaCV homepage and read the installation instructions.

Categories : Android

How do I find out in the OpenCV C Inerface,...In what .so a OpenCV function is defined
You need to look into http://docs.opencv.org. If you were to try and locate the Sobel function for instance, you would see that the documentation path is (at the top of the webpage OpenCV 2.4.6.0 documentation » OpenCV API Reference » imgproc. Image Processing) So the corresponding module is imgproc. You can use this to locate into which module your functions are

Categories : C

Thresholding for tiff stack looks at entire stack instead of individual tiff image
To correct a fluorescence signal bleaching over time, consider using the bleach corrector plugin for ImageJ. When thresholding a stack in ImageJ you can calculate the threshold separately for each slice: Image > Adjust > Threshold... leave Stack histogram unchecked to get a preview for the threshold calculated based on the current slice click on Apply in the dialog, choose Calculate threshold for each image to apply the chosen thresholding method to each stack slice separately. In order to get the macro source code for this procedure, start the ImageJ macro recorder via Plugins > Macros > Record... before starting.

Categories : Matlab

OpenCV+Eclipse+Android: Error org.opencv.video Video.java
If someone have this problem, do this: In OpenCV project.properties change target=android-11 (or in some cases 14) to target=android-17. Edit: For the newer OpenCV-2.4.10-android-sdk you will need to change it to target=android-20.

Categories : Java

Conversion of opencv C++ code to Python opencv code
As Abid commented, I would use cv2 rather than cv module. Since cv2 is based on c++ interface, you can develop scripts with fewer lines of code assuming you can do OOP. Another advantage of using cv2 is that python statement is mostly analogous to its c++ statement drawing2 = cv2.absdiff(drawing,drawing0) sc = cv2.sumElems(drawing2) ar = sc[0] + sc[1] + sc[2] More details are here

Categories : C++

Always automatic log in WiX
MsiLogging property is your solution here. According to the documentation: The MsiLogging property sets the default logging mode for the Windows Installer package. If this optional property is present in the Property table, the installer generates a log file named MSI*.LOG. The full path to the log file is given by the value of the MsiLogFileLocation property.

Categories : Wix

Automatic log out in Devise
You could override the after_signup_path_for(resource) method as shown in this SO answer: http://stackoverflow.com/a/5466245/367869. In that method you could make a call to something like sign_out current_user However, I do agree with user136060's comment to your question - if all you're doing is a mailing list, Devise is probably overkill.

Categories : Ruby On Rails

Why is constexpr not automatic?
This is only my evaluation, but I believe your (b) reason is correct (that it forms part of the interface that the compiler can enforce). The interface requirement serves both for the writer of the code and the client of the code. The writer may intend something to be usable in a compile-time context, but not actually use it in this way. If the writer violates the rules for constexpr, they might not find out until after publication when clients who try to use it constexpr fail. Or, more realistically, the library might use the code in a constexpr sense in version 1, refactor this usage out in version 2, and break constexpr compatibility in version 3 without realizing it. By checking constexpr-compliance, the breakage in version 3 will be caught before deployment. The interface for th

Categories : C++

DIV width automatic with CSS?
You can use the same class style for them and set a common size for them if you want like this: <div id="container> <div id="left" class="outerdivs"></div> <div id="mid"></div> <div id="right" class="outerdivs"></div> </div>

Categories : CSS

Automatic Uploader
Please note that cronjobs , POST/GET and REST are 3 different things and they do 3 different things . A simple approach would be to use Inotify to monitor the upload folder. When a new file is added its sends a trigger to a php file that uploads the files to your server.This way the file is uploaded as soon as they are created or modified.

Categories : PHP

Automatic Progress Bar
I think the main culprit is the setTimeout built-in which loses the connection to the local this. I replaced it with qx.event.Timer.once and it works like a charm. See the code in this Playground sample. Press the "Log" button of the Playground to see the log messages.

Categories : Javascript

Div is not automatic height as specified
You need to clear your floats or set overflow: auto to your parent container: #Mid_Container { width:1048px; height:auto; min-height:1100px; margin:0 auto; margin-top:15px; padding:0; position:relative; border:1px solid #a9a9a9; background-color:#f7f7f7; overflow: auto; /* cause this block to enclose floated child elements */ } Modified jsfiddle: http://jsfiddle.net/audetwebdesign/JRd9z/1/

Categories : HTML

Overriding an automatic property
Yes, just as if it was not defined as an automatic property. The allocation is needed in the base class, because it still needs to exist and be useful. The base class has no knowledge of the existence of the derived class, and the derived class can use the backing field in its definition If you have a base and derived class defined like: public class Base { public virtual string Name {get; set;} } public class Derived : Base { private string _name; public override string Name { get { return _name; } set { //access the base property we are overriding base.Name = value + " from derived"; _name = value; } } } You can use reflection to see that the backing field of the base class does indeed exist, and behaves as expected: Type

Categories : C#

Getting an automatic serialNumber from the database
In SQL SERVER, while creating your table use IDENTITY(1,1) function that will automatically increment to next value. After insert query use @@IDENTITY variable to get the last identity value entered into a table in your current session Something like // Create your table CREATE TABLE Persons ( ID int IDENTITY(1,1) PRIMARY KEY, LastName varchar(255) NOT NULL, ) //Create your procedure create procedure myproc as begin insert into persons(lastname) values('jasdg'); print @@identity; // use this variable to get the last value generated end Although, you can also use SCOPE_IDENTITY instead of @@IDENTITY, so better visit this blog to use suitable one.

Categories : Sql Server

Jquery automatic scroll
look at this or use a jquery plugin

Categories : Jquery

How does certain classes cause automatic instantiation and others do not?
What line of code actually makes this difference between the 2 classes The line of code you've not shown. To append to test3 as a string, you perform an additional assignment: test3 = test3 + "abc"; (If you don't perform an assignment here, the newly generated string is immediately eligible for garbage collection since nothing is holding a reference to it) To append to test3 as a StringBuilder, there's no additional assignment: test3.Append("abc"); Suppose I wanted to make my own simple byte class one that behaves like StringBuilder and one that behaves like String To create a class like StringBuilder, you would create a class that modifies its internal state when "modifying" methods like Append() are called on it. To create a class like String, you would create a class

Categories : C#

Automatic theorem proving
Checkout prolog. It's great for logical propositions and that sort of thing. Start with a read through the wiki and see if it sounds like what you want. It is a logical programming language - it will help you to build your own theorem proving algorithms. Wiki: http://en.wikipedia.org/wiki/Prolog Tutorials: http://cs.union.edu/~striegnk/courses/esslli04prolog/index.php

Categories : Prolog

W32 textbox automatic newline
You need to include the ES_MULTILINE style when creating the control. http://msdn.microsoft.com/en-us/library/windows/desktop/bb775464(v=vs.85).aspx

Categories : C

Automatic Email Mechanism
try this: HttpContext.Current.Cache.Add(CacheItemKey, "Test", null, DateTime.Now.AddHours(24), System.Web.Caching.Cache.NoSlidingExpiration, CacheItemPriority.Normal, new CacheIRemovedCallback(CacheIRemovedCallback)); Syntax as in MSDN: public Object Add( string key, Object value, CacheDependency dependencies, DateTime absoluteExpiration, TimeSpan slidingExpiration, CacheItemPriority priority, CacheItemRemovedCallback onRemoveCallback ) Items are guaranteed to remain in cache for minimum 10 minutes, this is a default setting. So email sent every 10 minutes means that setting expiration time is not successful. You may change it with absoluteExpiration and slidingExpiration parameters. I suspect however that problem

Categories : C#



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