所以我想通过 document.getElementsByClassName(); 获取所有类元素;
<body>
<div class="circle" id="red"></div>
<div class="circle" id="blue"></div>
<div class="circle" id="yellow"></div>
<input id="disappear" type="button" value="disappear" onclick="disappear()">
</body>
<script>
function disappear(){
document.getElementsByClassName(".circle").style.display = none;
}
</script>
Run Code Online (Sandbox Code Playgroud)
我想让那些圆圈消失 document.getElementsByClassName(".circle").style.display = none;
这不起作用所以我使用了
function disappear(){
var x, i;
x = document.querySelectorAll(".circle");
for (i = 0; i < x.length; i++) {
x[i].style.display = "none";
}
}
Run Code Online (Sandbox Code Playgroud)
我的问题是,有没有办法在没有循环的情况下选择所有类?
我的 pom.xml 文件中已经有了这个依赖项
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-validation</artifactId>
</dependency>
Run Code Online (Sandbox Code Playgroud)
并刷新 Maven 并已重新启动 IntelliJ 但总是出现此错误
java: package javax.validation.constraints does not exist
由于某种原因,它找不到这个包。但是这个错误只发生在运行时。
在我导入的实体类中 import javax.validation.constraints.Size;
并希望向列添加注释,例如:
@Size(min = 1)
private String name;
Run Code Online (Sandbox Code Playgroud)
或者
@DecimalMin("0.01")
private BigDecimal amount;
Run Code Online (Sandbox Code Playgroud)
但我总是遇到验证包的问题。
IDE中没有错误信息,我运行时出现错误。
我这里有这张图像,其中有很多青色、品红色和黄色的小打印机点。
分离颜色通道 (CMYK) 后,我在图像上应用了阈值。
这里的颜色通道为青色。
现在我想找到一种方法来计算每个点的周长。所以最后我想要得到周长的平均值和标准差。
我已经找到了一种方法(在 stackoverflow 上某人的帮助下)来计算点大小的平均值和标准偏差:
def compute_mean_stddev(contours_of_images):
for contours_of_image in contours_of_images:
count = len(contours_of_image)
sum_list = []
for cntr in contours_of_image:
area = cv2.contourArea(cntr)
sum_list.append(area)
average = np.mean(sum_list)
standard_deviation = np.std(sum_list)
Run Code Online (Sandbox Code Playgroud)
现在对于面积来说,有没有办法得到周长?