towhee
copied
Readme
Files and versions
Updated 3 months ago
towhee
Image Crop Implementation with CV2
author: David Wang
Description
An image crop operator implementation with OpenCV.
Code Example
Crop the face from 'avengers.jpg'.
from towhee import pipe, ops, DataCollection
p = (
pipe.input('path')
.map('path', 'img', ops.image_decode())
.map('img', ('box','score'), ops.face_detection.retinaface())
.map(('img', 'box'), 'crop', ops.image_crop(clamp = True))
.output('img', 'crop')
)
DataCollection(p('./avengers.jpg')).show()
Factory Constructor
Create the operator via the following factory method
image_crop(clamp = True)
Parameters:
clamp: bool
If set True, coordinates of bounding boxes would be clamped into image size.
Interface
An image crop operator takes an image and bounding boxes as input. It cropes the image into ROIs(region of interest).
Parameters:
img: towhee.types.Image (a sub-class of numpy.ndarray)
The image need to be cropped.
bboxes: numpy.ndarray
The nx4 numpy tensor for n bounding boxes need to crop, each row is formatted as (x1, y1, x2, y2).
Returns: towhee.types.Image (a sub-class of numpy.ndarray)
The cropped image data as numpy.ndarray.
# More Resources
- [Supercharged Semantic Similarity Search in Production - Zilliz blog](https://zilliz.com/learn/supercharged-semantic-similarity-search-in-production): Building a Blazing Fast, Highly Scalable Text-to-Image Search with CLIP embeddings and Milvus, the most advanced open-source vector database.
- The guide to clip-vit-base-patch32 | OpenAI: clip-vit-base-patch32: a CLIP multimodal model variant by OpenAI for image and text embedding.
- Using Vector Search to Better Understand Computer Vision Data - Zilliz blog: How Vector Search improves your understanding of Computer Vision Data
- Demystifying Color Histograms: A Guide to Image Processing and Analysis - Zilliz blog: Mastering color histograms is indispensable for anyone involved in image processing and analysis. By understanding the nuances of color distributions and leveraging advanced techniques, practitioners can unlock the full potential of color histograms in various imaging projects and research endeavors.
- Understanding ImageNet: A Key Resource for Computer Vision and AI Research: The large-scale image database with over 14 million annotated images. Learn how this dataset supports advancements in computer vision.
- From Text to Image: Fundamentals of CLIP - Zilliz blog: Search algorithms rely on semantic similarity to retrieve the most relevant results. With the CLIP model, the semantics of texts and images can be connected in a high-dimensional vector space. Read this simple introduction to see how CLIP can help you build a powerful text-to-image service.
Jael Gu
c1ae829900
| 14 Commits | ||
---|---|---|---|
.gitattributes |
1.1 KiB
|
3 years ago | |
README.md |
3.1 KiB
|
3 months ago | |
__init__.py |
719 B
|
3 years ago | |
image_crop_cv2.py |
1.7 KiB
|
2 years ago | |
requirements.txt |
7 B
|
3 years ago | |
result2.png |
123 KiB
|
3 years ago |