Is Wrapping a Div Inside an Anchor Tag Valid Code?

AmitDiwan
Updated on 05-Dec-2022 11:54:29

7K+ Views

Yes, according to HTML5 Specifications, we can place a div inside an anchor tag, for example − Another example − this now becomes a link The HTML5 allows tag to be wrapped around a element. Therefore, the will be visible inside the tag.Example Let us see an example for div inside the tag − .container { position: relative; background-color: orange; width: 200px; height: 200px; } .container a { position: absolute; top: 0; bottom: 0; left: 0; right: 0; z-index: 999; } Demo Heading div one div two Output Click on the orange colored div and the link will open −

jQuery Data vs Attr

AmitDiwan
Updated on 05-Dec-2022 11:51:30

2K+ Views

The data() in jQuery is used to fetch the value of any custom data attribute from the matched HTML element(s). The jQuery attr() method is used to fetch the value of any standard attribute from the matched HTML element(s). Let us see the differences − The .attr() method includes DOM Manipulation and gets the data from the current HTML or change the HTML code if used to change an attribute value. The .data() method does not include DOM manipulation and gets the data from the internal cache and will change that data if a set is called. The .data() ... Read More

Detect License Plates Using OpenCV in Python

Shahid Akhtar Khan
Updated on 05-Dec-2022 11:24:33

15K+ Views

We will use the Haar cascade classifier to detect the license number plate in the image. A haar cascade classifier is an effective object detection method. It is a machine learning based approach. To train a number plate classifier, the algorithm initially needs a lot of positive images (images of number plates) and negative images (images without number plates). The classifier is trained from these positive and negative images. It is then used to detect objects (number plates) in other images. We can use already trained haar cascades for object detection. How to Download Haarcascade? You can find different ... Read More

Smile Detection Using Haar Cascade in OpenCV with Python

Shahid Akhtar Khan
Updated on 05-Dec-2022 11:21:42

3K+ Views

We will use the Haar cascade classifier for smile detection in an image. A haar cascade classifier is an effective object detection method. It is a machine learning based approach. To train a haar cascade classifier for smile detection, the algorithm initially needs a lot of positive images (images with smile) and negative images (images without smile). Then the classifier is trained from these positive and negative images. It is then used to detect smiles in other images. We can use already trained haar cascades for smile detection. For smile detection in the input image, we need two haar ... Read More

Find Patterns in a Chessboard Using OpenCV Python

Shahid Akhtar Khan
Updated on 05-Dec-2022 11:19:48

9K+ Views

We could find chessboard corners in an image using cv2.findChessboardCorners() and to draw the chessboard corners with a pattern, we could use cv2.drawChessboardCorners(). Look at the below syntaxes for these two methods − ret, corners = cv2.findChessboardCorners(img, patterSize, None) cv2.drawChessboardCorners(img, patternSize, corners, ret) Steps To find the patterns in a chessboard, you can use the steps given below − Import the required library. In all the following examples, the required Python library is OpenCV. Make sure you have already installed it. Read the input image of a chessboard using cv2.imread() and convert it to grayscale using cv2.cvtColor(). ... Read More

Detect Cat Faces in an Image using OpenCV and Python

Shahid Akhtar Khan
Updated on 05-Dec-2022 11:17:36

2K+ Views

A haar cascade classifier is an effective object detection method. It is a machine learning based approach. To train a haar cascade classifier for cat face detection, the algorithm initially needs a lot of positive images (images with cat faces) and negative images (images without cat faces). The classifier is trained from these positive and negative images. It is then used to detect cat faces in other images. We can use already trained haar cascades for smile detection. For smile detection in the input image we need two haar cascades one for face detection and other for smile detection. We ... Read More

Crop and Save Detected Faces in OpenCV Python

Shahid Akhtar Khan
Updated on 05-Dec-2022 11:15:08

6K+ Views

We can use the already trained haar cascade classifier to detect the faces in the image. To detect faces OpenCV provides us with different haar cascades as xml files. We will use haarcascade_frontalface_alt.xml for human face detection in the image. The detected face coordinates are in (x, y, w, h). To crop and save the detected face we save the image[y:y+h, x:x+w]. How to Download Haarcascades? You can find different haarcascades following the GitHub website address − https://github.com/opencv/opencv/tree/master/data/haarcascades To download the haar cascade for human face detection click on the haarcascade_frontalface_alt.xml file. Open it in raw format, right click ... Read More

Implementing K-Nearest Neighbor in OpenCV Python

Shahid Akhtar Khan
Updated on 05-Dec-2022 11:12:46

1K+ Views

k-Nearest Neighbor (kNN) is a simple classification algorithm for supervised learning. To implement kNN in OpenCV, you can follow the steps given below − Import the required libraries OpenCV, NumPy and Matplotlib. We define two classes Red and Blue each having 25 numbers. Then generate training data for these two classes using a random generator. Next, we generate the Labels for each training data. The label for Red family numbers is 0 and for Blue family members is 1. Now plot the Red and Blue family members. Generate a new number using the random generator and plot it. Initiate ... Read More

Detect Humans in an Image Using OpenCV in Python

Shahid Akhtar Khan
Updated on 05-Dec-2022 11:10:57

15K+ Views

To detect humans in an image and draw bounding boxes around them, you can use the steps given below − Import the required library. In all the following examples, the required Python library is OpenCV. Make sure you have already installed it. Read the input image using cv2.imread() in a grayscale. Specify the full image path. Initialize a HOG descriptor object hog = cv2.HOGDescriptor() and set the SVM detector as hog.setSVMDetector() as default people detector. Detect humans in the input image using hog.detectMultiScale(). It returns the coordinates of detected humans in (x, y, w, h) format. Loop over all ... Read More

Detect Polygons in Image using OpenCV Python

Shahid Akhtar Khan
Updated on 05-Dec-2022 11:08:22

6K+ Views

We first detect all the object contours in the image to detect a polygon. Then Loop over all contours. Find the approximate contour for each of the contours. If the number of vertex points in the approximate contour is 5 or more then draw the contour and set it as a triangle. See the below pseudocode. for cnt in contours: approx = cv2.approxPolyDP() if len(approx) >= 5: cv2.drawContours() cv2.putText("Polygon") Steps We could use the following steps to detect polygons in an ... Read More

Advertisements