我尝试使用下面的代码绘制一些子图。当我使用OpenCv时图像很好,但是当我使用pyplot时,颜色会改变。 请参阅图片和代码。
用cv2绘图
import cv2
from matplotlib import pyplot as plt
img = cv2.imread('image.jpg')
fig = plt.figure()
ax1 = fig.add_subplot(221)
ax2 = fig.add_subplot(223)
ax3 = fig.add_subplot(224)
ax1.imshow(img)
ax1.set_title('Original Image')
ax2.imshow(imgRedimensionata_proiect)
ax2.set_title('Alg image')
ax3.imshow(imgRedimensionata_traditional)
ax3.set_title('Traditional resize')
fig.show()
cv2.imshow('image',img)
cv2.waitKey(0)
答案 0 :(得分:2)
看起来像是在接受BGR并将其显示为RGB(或反之亦然)。添加这样的东西来解决它。
public class AuthenticationSuccessHandler implements AuthenticationSuccessHandler {
@Override
public void onAuthenticationSuccess(HttpServletRequest request, HttpServletResponse response, Authentication authentication) throws IOException {
// Very simple (most probably broken) check if the user is ADMIN or USER
if (authentication.getAuthorities().stream().filter(a -> a.getAuthority().equals("USER")).findAny() != null){
redirectStrategy.sendRedirect(request, response, "/profile.html");
} else {
redirectStrategy.sendRedirect(request, response, "/admin.html");
}
clearAuthenticationAttributes(request);
}
}