I want to include figures and listings in my document and I want them to have the same spacings to text and captions.
\documentclass[a4paper,12pt,openany,parskip,oneside,ngerman,headsepline]{scrbook}
\usepackage{float}
\usepackage{graphicx}
\usepackage{caption}
\captionsetup{font=small,labelfont=bf}
\usepackage{listings}
\lstset{captionpos=b,frame=single}
\begin{document}
Some text
\begin{lstlisting}[caption={Some caption}]
Some code
\end{lstlisting}
Some text
\begin{figure}[H]
\includegraphics[width=\textwidth]{image.png}
\caption{Some caption}
\label{fig:test}
\end{figure}
Some rext
\end{document}
The result is following (I added boxes to show the spacing).

As you can see, the red boxes have the same spacing. How can I make the spacing start above/below the frame?
The spacing below the figure is bigger than the listing. How can I make them the same?
