当前位置:网站首页>Three dimensional function display of gray image
Three dimensional function display of gray image
2022-07-25 17:17:00 【Mr anhydrous】
One 、 summary
How to see the three-dimensional gray distribution of an image ? sometimes , You need to clearly see the relationship between image gray and coordinates . In this way, try to intuitively understand the data details of the image . This article describes how to change the gray scale of a gray-scale image gray and row and col Composed of three-dimensional intuitive graphics . This article describes how to use python Realization .
Two 、 Ask questions
Give the original drawing , obviously , The illumination of this picture is uneven , If you want to remove it, you must first see its function direction :

3、 ... and 、 The procedure for processing the original image is :
# !/usr/bin/env python
# -*- coding: utf-8 -*-
# @File : Plt3D.py
from matplotlib import pyplot as plot # Used to draw figures
import numpy as np # Used to process data
from mpl_toolkits.mplot3d import Axes3D # Used to give a three-dimensional coordinate system .
import cv2
def getZ( img, X, Y ):
gray = img[X,Y]
return gray
img = cv2.imread("paper.jpg",0)
height,width = img.shape[:2]
figure = plot.figure()
# Draw a three-dimensional coordinate system :
axes = Axes3D(figure)
X = np.arange(0, height, 1)
Y = np.arange(0, width, 1)
# Generate two-dimensional bottom grid lines :
X, Y = np.meshgrid(X, Y)
# Z = 3 * (X) ** 2 + 2 * (Y) ** 2 + 5
# Draw surfaces :
axes.plot_surface(X, Y, getZ(img,X,Y), cmap='rainbow')
# The graphics :
plot.show()Four 、 Code key
4.1 Face region generation
Given two domains ,X,Y, that ,X and Y Joint region S Need to generate :

X, Y = np.meshgrid(X, Y)
Be careful : Here if X = 【2,3,4】,Y=【7.8.9.10】 Then after the above sentence ,
X = [ [2 3 4], [2 3 4], [2 3 4] , [2 3 4] ]
Y = [ [ 7 7 7], [ 8 8 8], [ 9 9 9], [10 10 10] ]
- How to get grayscale ?
def getZ( img, X, Y ):
gray = img[X,Y]
return gray- Grayscale gray = getZ(img,X,Y):
[ [70 70 67], [69 69 67], [67 67 68], [66 68 69] ]
5、 ... and 、 After processing, three-dimensional visual graphics are generated
- Draw statement
axes.plot_surface(X, Y, getZ(img,X,Y), cmap='rainbow')
This function displays three-dimensional functions in three-dimensional coordinates .

边栏推荐
- 我们被一个 kong 的性能 bug 折腾了一个通宵
- 数据分析与隐私安全成 Web3.0 成败关键因素,企业如何布局?
- [redis] redis installation
- [target detection] yolov5 Runtong visdrone data set
- postgreSQL 密码区分大小写 ,有参数控制吗?
- Starting from business needs, open the road of efficient IDC operation and maintenance
- 02.两数相加
- EasyUI DataGrid control uses
- C # introductory basic tutorial
- 简述redis集群的实现原理
猜你喜欢

ACL 2022 | comparative learning based on optimal transmission to achieve interpretable semantic text similarity

How to prevent the unburned gas when the city gas safety is alarmed again?
![[Nanjing University of Aeronautics and Astronautics] information sharing for the first and second examinations of postgraduate entrance examination](/img/d8/a367c26b51d9dbaf53bf4fe2a13917.png)
[Nanjing University of Aeronautics and Astronautics] information sharing for the first and second examinations of postgraduate entrance examination

Outlook 教程,如何在 Outlook 中搜索日历项?

数据分析与隐私安全成 Web3.0 成败关键因素,企业如何布局?

jenkins的文件参数,可以用来上传文件

用秩讨论线性方程组的解/三个平面的位置关系

Hcip notes 11 days

【目标检测】TPH-YOLOv5:基于transformer的改进yolov5的无人机目标检测

虚拟内存管理
随机推荐
Enumeration classes and magic values
第六章 继承
免费的低代码开发平台有哪些?
The gas is exhausted! After 23 years of operation, the former "largest e-commerce website in China" has become yellow...
Rosen's QT journey 99 QML table control tableview
一百个用户眼中,就有一百个QQ
更新|3DCAT实时云渲染 v2.1.2版本全新发布
Headless mode of new selenium4.3 in egde browser
[OBS] Reprint: what about the serious delay of OBS live broadcast and Caton?
Chapter VI succession
How to deploy applications on IPFs using 4everland cli
Use huggingface to quickly load pre training models and datasets in moment pool cloud
win10自带的框选截图快捷键
HCIP笔记十一天
02.两数相加
Hcip notes 11 days
Replicate swin on Huawei ascend910_ transformer
How to prevent the unburned gas when the city gas safety is alarmed again?
03. Longest substring without repeated characters
第三章、数据类型和变量