import numpy as np
import cv2
frame = cv2.imread( '/home/nirvan/img_two.png' , cv2.IMREAD_GRAYSCALE)
string = ' '.join(map(str,frame.flatten().tolist()))
frameCopy = frame.copy()
x = frame.shape[0]
y = frame.shape[1]
frame = string.strip()
temp = [ int(t) for t in frame.split(' ')]
temp = np.array(temp)
temp = temp.reshape( (x,y) )
print( np.array_equal(frameCopy , temp) )
#gives black screen
cv2.imshow('l' , np.array(temp) )
#gives proper image
#cv2.imshow('l' , np.array(frameCopy) )
cv2.waitKey()
HTML:
function validateForm() {
if (document.getElementById('name').value = "") {
alert('Name field is required!');
document.getElementById('name').focus();
return false;
} else if (document.getElementById('email').value = "") {
alert("Email field is required!");
document.getElementById('email').focus();
return false;
} else if (document.getElementById('password1').value != document.getElementById('password2').value) {
alert("Passwords have to match!");
return false;
}
return true;
}
为什么它总是返回true,即使其中一个字段为空?